From c58c668b24b0ceb02fa73012342aa822df3efb6c Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sun, 10 Dec 2023 01:57:33 +0100 Subject: Changed xstrdup() --- FICS/utils.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/FICS/utils.c b/FICS/utils.c index 2861819..c5e3353 100644 --- a/FICS/utils.c +++ b/FICS/utils.c @@ -557,15 +557,15 @@ PUBLIC int printablestring(char *str) return 1; } -PUBLIC char *xstrdup(const char *str) +PUBLIC char * +xstrdup(const char *str) { - char *tmp; + char *out; - if (!str) - return NULL; - tmp = rmalloc(strlen(str) + 1); - strcpy(tmp, str); - return tmp; + if (str == NULL) + return NULL; + out = rmalloc(strlen(str) + 1); + return strcpy(out, str); } PUBLIC char *hms_desc(int t) -- cgit v1.2.3