Remove the HASLB and FREEUB macros.
Because we hate macros.
Bug: N/A
Test: ran tests
Change-Id: I2c94085ff502ec5ce6d8598ec6b3c10e7a4b5510
diff --git a/libc/stdio/stdio.cpp b/libc/stdio/stdio.cpp
index b0f5c60..cd4be2e 100644
--- a/libc/stdio/stdio.cpp
+++ b/libc/stdio/stdio.cpp
@@ -132,6 +132,13 @@
return g;
}
+static inline void free_fgetln_buffer(FILE* fp) {
+ if (__predict_false(fp->_lb._base != nullptr)) {
+ free(fp->_lb._base);
+ fp->_lb._base = nullptr;
+ }
+}
+
/*
* Find a free FILE for fopen et al.
*/
@@ -326,7 +333,7 @@
if (HASUB(fp)) FREEUB(fp);
_UB(fp)._size = 0;
WCIO_FREE(fp);
- if (HASLB(fp)) FREELB(fp);
+ free_fgetln_buffer(fp);
fp->_lb._size = 0;
if (fd < 0) { // Did not get it after all.
@@ -386,7 +393,7 @@
}
if (fp->_flags & __SMBF) free(fp->_bf._base);
if (HASUB(fp)) FREEUB(fp);
- if (HASLB(fp)) FREELB(fp);
+ free_fgetln_buffer(fp);
// Poison this FILE so accesses after fclose will be obvious.
fp->_file = -1;