From: Joel Rosdahl Date: Tue, 28 Jul 2020 12:00:03 +0000 (+0200) Subject: Remove now unused legacy format function X-Git-Tag: v4.0~273 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b5e43fb9a14221ae000916acb9fce50d11e4af6b;p=thirdparty%2Fccache.git Remove now unused legacy format function --- diff --git a/src/legacy_util.cpp b/src/legacy_util.cpp index e3dce0814..797265370 100644 --- a/src/legacy_util.cpp +++ b/src/legacy_util.cpp @@ -101,25 +101,6 @@ get_hostname() return hostname; } -// Construct a string according to a format. Caller frees. -char* -format(const char* format, ...) -{ - va_list ap; - va_start(ap, format); - - char* ptr = nullptr; - if (vasprintf(&ptr, format, ap) == -1) { - fatal("Out of memory in format"); - } - va_end(ap); - - if (!*ptr) { - fatal("Internal error in format"); - } - return ptr; -} - // This is like setenv. void x_setenv(const char* name, const char* value) diff --git a/src/legacy_util.hpp b/src/legacy_util.hpp index 74af3986b..cee484d6e 100644 --- a/src/legacy_util.hpp +++ b/src/legacy_util.hpp @@ -27,7 +27,6 @@ void fatal(const char* format, ...) ATTR_FORMAT(printf, 1, 2) ATTR_NORETURN; bool write_fd(int fd, const void* buf, size_t size); bool copy_fd(int fd_in, int fd_out); const char* get_hostname(); -char* format(const char* format, ...) ATTR_FORMAT(printf, 1, 2); void x_setenv(const char* name, const char* value); void x_unsetenv(const char* name); #ifndef HAVE_LOCALTIME_R