From 5331b305a565f7b33b9b39d1364efa602ce97279 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Tue, 28 Jul 2020 09:04:50 +0200 Subject: [PATCH] Remove now unused legacy x_strdup function --- src/legacy_util.cpp | 13 +------------ src/legacy_util.hpp | 1 - 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/legacy_util.cpp b/src/legacy_util.cpp index 24edc6aaa..9de72e69d 100644 --- a/src/legacy_util.cpp +++ b/src/legacy_util.cpp @@ -120,17 +120,6 @@ format(const char* format, ...) return ptr; } -// This is like strdup() but dies if the malloc fails. -char* -x_strdup(const char* s) -{ - char* ret = strdup(s); - if (!ret) { - fatal("Out of memory in x_strdup"); - } - return ret; -} - // This is like setenv. void x_setenv(const char* name, const char* value) @@ -149,7 +138,7 @@ x_unsetenv(const char* name) #ifdef HAVE_UNSETENV unsetenv(name); #else - putenv(x_strdup(name)); // Leak to environment. + putenv(strdup(name)); // Leak to environment. #endif } diff --git a/src/legacy_util.hpp b/src/legacy_util.hpp index 122a083c6..dfb67d817 100644 --- a/src/legacy_util.hpp +++ b/src/legacy_util.hpp @@ -28,7 +28,6 @@ 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); -char* x_strdup(const char* s); void x_setenv(const char* name, const char* value); void x_unsetenv(const char* name); #ifndef HAVE_LOCALTIME_R -- 2.47.2