diff options
Diffstat (limited to 'libc/stdio/vfprintf.cpp')
-rw-r--r-- | libc/stdio/vfprintf.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/libc/stdio/vfprintf.cpp b/libc/stdio/vfprintf.cpp index 17e4372cd..7a6786892 100644 --- a/libc/stdio/vfprintf.cpp +++ b/libc/stdio/vfprintf.cpp @@ -64,7 +64,7 @@ int FUNCTION_NAME(FILE* fp, const CHAR_TYPE* fmt0, va_list ap) { * D: expchar holds this character; '\0' if no exponent, e.g. %f * F: at least two digits for decimal, at least one digit for hex */ - char* decimal_point = NULL; + char* decimal_point = nullptr; int signflag; /* true if float is negative */ union { /* floating point arguments %[aAeEfFgG] */ double dbl; @@ -77,7 +77,7 @@ int FUNCTION_NAME(FILE* fp, const CHAR_TYPE* fmt0, va_list ap) { int lead; /* sig figs before decimal or group sep */ int ndig; /* actual number of digits returned by dtoa */ CHAR_TYPE expstr[MAXEXPDIG + 2]; /* buffer for exponent string: e+ZZZ */ - char* dtoaresult = NULL; + char* dtoaresult = nullptr; uintmax_t _umax; /* integer arguments %[diouxX] */ enum { OCT, DEC, HEX } base; /* base for %[diouxX] conversion */ @@ -146,14 +146,14 @@ int FUNCTION_NAME(FILE* fp, const CHAR_TYPE* fmt0, va_list ap) { } CHAR_TYPE* fmt = const_cast<CHAR_TYPE*>(fmt0); - argtable = NULL; + argtable = nullptr; nextarg = 1; va_copy(orgap, ap); uio.uio_iov = iovp = iov; uio.uio_resid = 0; uio.uio_iovcnt = 0; ret = 0; - convbuf = NULL; + convbuf = nullptr; /* * Scan the format for conversions (`%' character). @@ -226,7 +226,7 @@ int FUNCTION_NAME(FILE* fp, const CHAR_TYPE* fmt0, va_list ap) { } if (ch == '$') { nextarg = n; - if (argtable == NULL) { + if (argtable == nullptr) { argtable = statargtable; if (__find_arguments(fmt0, orgap, &argtable, &argtablesiz) == -1) { ret = -1; @@ -261,7 +261,7 @@ int FUNCTION_NAME(FILE* fp, const CHAR_TYPE* fmt0, va_list ap) { } while (is_digit(ch)); if (ch == '$') { nextarg = n; - if (argtable == NULL) { + if (argtable == nullptr) { argtable = statargtable; if (__find_arguments(fmt0, orgap, &argtable, &argtablesiz) == -1) { ret = -1; @@ -353,14 +353,14 @@ int FUNCTION_NAME(FILE* fp, const CHAR_TYPE* fmt0, va_list ap) { if (flags & LONGDBL) { fparg.ldbl = GETARG(long double); dtoaresult = cp = __hldtoa(fparg.ldbl, xdigs, prec, &expt, &signflag, &dtoaend); - if (dtoaresult == NULL) { + if (dtoaresult == nullptr) { errno = ENOMEM; goto error; } } else { fparg.dbl = GETARG(double); dtoaresult = cp = __hdtoa(fparg.dbl, xdigs, prec, &expt, &signflag, &dtoaend); - if (dtoaresult == NULL) { + if (dtoaresult == nullptr) { errno = ENOMEM; goto error; } @@ -390,14 +390,14 @@ int FUNCTION_NAME(FILE* fp, const CHAR_TYPE* fmt0, va_list ap) { if (flags & LONGDBL) { fparg.ldbl = GETARG(long double); dtoaresult = cp = __ldtoa(&fparg.ldbl, expchar ? 2 : 3, prec, &expt, &signflag, &dtoaend); - if (dtoaresult == NULL) { + if (dtoaresult == nullptr) { errno = ENOMEM; goto error; } } else { fparg.dbl = GETARG(double); dtoaresult = cp = __dtoa(fparg.dbl, expchar ? 2 : 3, prec, &expt, &signflag, &dtoaend); - if (dtoaresult == NULL) { + if (dtoaresult == nullptr) { errno = ENOMEM; goto error; } @@ -479,18 +479,18 @@ int FUNCTION_NAME(FILE* fp, const CHAR_TYPE* fmt0, va_list ap) { wchar_t* wcp; free(convbuf); - convbuf = NULL; - if ((wcp = GETARG(wchar_t*)) == NULL) { + convbuf = nullptr; + if ((wcp = GETARG(wchar_t*)) == nullptr) { cp = const_cast<char*>("(null)"); } else { convbuf = helpers::wcsconv(wcp, prec); - if (convbuf == NULL) { + if (convbuf == nullptr) { ret = -1; goto error; } cp = convbuf; } - } else if ((cp = GETARG(char*)) == NULL) { + } else if ((cp = GETARG(char*)) == nullptr) { cp = const_cast<char*>("(null)"); } if (prec >= 0) { @@ -625,7 +625,7 @@ int FUNCTION_NAME(FILE* fp, const CHAR_TYPE* fmt0, va_list ap) { if ((flags & FPT) == 0) { PRINT(cp, size); } else { /* glue together f_p fragments */ - if (decimal_point == NULL) decimal_point = nl_langinfo(RADIXCHAR); + if (decimal_point == nullptr) decimal_point = nl_langinfo(RADIXCHAR); if (!expchar) { /* %[fF] or sufficiently short %[gG] */ if (expt <= 0) { PRINT(zeroes, 1); @@ -676,9 +676,9 @@ overflow: finish: free(convbuf); if (dtoaresult) __freedtoa(dtoaresult); - if (argtable != NULL && argtable != statargtable) { + if (argtable != nullptr && argtable != statargtable) { munmap(argtable, argtablesiz); - argtable = NULL; + argtable = nullptr; } return (ret); } |