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)
#ifdef HAVE_UNSETENV
unsetenv(name);
#else
- putenv(x_strdup(name)); // Leak to environment.
+ putenv(strdup(name)); // Leak to environment.
#endif
}
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