X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Falloc_str.c;h=45ea49125d9eb85ed5d4f16276e5ba644a9bcdbe;hb=3b44cc5e0858a329f647bee0617fbab117ea5ea9;hp=baf5f5adf94cfc844da495e49de1b95dd6055e58;hpb=1571781022499a9d0c32d249f89945d034d1cbff;p=libucw.git diff --git a/lib/alloc_str.c b/lib/alloc_str.c index baf5f5ad..45ea4912 100644 --- a/lib/alloc_str.c +++ b/lib/alloc_str.c @@ -2,6 +2,9 @@ * Sherlock Library -- String Allocation * * (c) 1997 Martin Mares + * + * This software may be freely distributed and used according to the terms + * of the GNU Lesser General Public License. */ #include "lib/lib.h" @@ -9,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); }