From 3c1aa682c064d952f39079c9492093f0dd041604 Mon Sep 17 00:00:00 2001 From: "Steffen (Daode) Nurpmeso" Date: Sat, 8 Feb 2014 18:16:36 +0100 Subject: [PATCH] sstrdup(): implement by means of sbufdup() --- strings.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/strings.c b/strings.c index b58ea7f4..9dddf26e 100644 --- a/strings.c +++ b/strings.c @@ -935,14 +935,10 @@ sstpcpy(char *dst, char const *src) FL char * (sstrdup)(char const *cp SMALLOC_DEBUG_ARGS) { - char *dp = NULL; + char *dp; NYD_ENTER; - if (cp != NULL) { - size_t l = strlen(cp) + 1; - dp = (smalloc)(l SMALLOC_DEBUG_ARGSCALL); - memcpy(dp, cp, l); - } + dp = (cp == NULL) ? NULL : (sbufdup)(cp, strlen(cp) SMALLOC_DEBUG_ARGSCALL); NYD_LEAVE; return dp; } -- 2.11.4.GIT