optimize more integer cases in floatscan; comment the whole procedure
[musl] / src / stdio / vfprintf.c
index 2c4fdf3..b5001ff 100644 (file)
@@ -570,8 +570,11 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg,
                case 'u':
                        a = fmt_u(arg.i, z);
                        }
-                       if (!arg.i && !p) continue;
                        if (p>=0) fl &= ~ZERO_PAD;
+                       if (!arg.i && !p) {
+                               a=z;
+                               break;
+                       }
                        p = MAX(p, z-a + !arg.i);
                        break;
                case 'c':
@@ -581,7 +584,7 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg,
                case 'm':
                        if (1) a = strerror(errno); else
                case 's':
-                       a = arg.p;
+                       a = arg.p ? arg.p : "(null)";
                        z = memchr(a, 0, p);
                        if (!z) z=a+p;
                        else p=z-a;