From f409090ae7a4ca4f7710c8306948177fdcb49613 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Mon, 10 May 2004 14:10:12 +0000 Subject: [PATCH] Renamed stralloc() to xstrdup() to be consistent with libc terminology and also with mp_strdup(). --- lib/alloc_str.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/alloc_str.c b/lib/alloc_str.c index 2b03eb2c..45ea4912 100644 --- a/lib/alloc_str.c +++ b/lib/alloc_str.c @@ -12,10 +12,8 @@ #include byte * -stralloc(byte *s) +xstrdup(byte *s) { - uns l = strlen(s); - byte *k = xmalloc(l + 1); - strcpy(k, s); - return k; + uns l = strlen(s) + 1; + return memcpy(xmalloc(l), s, l); } -- 2.39.5