]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Remove incorrect result check in `format`
authorJoel Rosdahl <joel@rosdahl.net>
Tue, 24 Mar 2020 20:33:56 +0000 (21:33 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 24 Mar 2020 20:33:56 +0000 (21:33 +0100)
`format` considers a zero-length result (e.g. from `format("%s", "")`)
to be a fatal error. The check originates from 0a7cea64 where it was
appropriate but become incorrect later when refactoring the original
`x_asprintf2` function to `format`.

I can’t find any call to `format` that would trigger this edge case, but
let’s remove the erroneous check anyway.

Related to #568.

src/util.c

index b6cce75efd643ec1754aae00d41f4491d35dcd24..0fd3f0fe3b53eb9f9627ca8f3b7879231ca82268 100644 (file)
@@ -703,9 +703,6 @@ format(const char *format, ...)
        }
        va_end(ap);
 
-       if (!*ptr) {
-               fatal("Internal error in format");
-       }
        return ptr;
 }