X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Falloc_str.c;h=ab7b467213b4c0303abfca4046e846648e94078b;hb=beb9738f1fbcba84bc0f09f742fb66b1ddfcf349;hp=7c9f92decdd999db49583c782ae8c240953f0d2d;hpb=03846211ba84582b133a985200502a39462dfe66;p=libucw.git diff --git a/lib/alloc_str.c b/lib/alloc_str.c index 7c9f92de..ab7b4672 100644 --- a/lib/alloc_str.c +++ b/lib/alloc_str.c @@ -1,19 +1,19 @@ /* - * Sherlock Library -- String Allocation + * UCW Library -- String Allocation * - * (c) 1997 Martin Mares, + * (c) 1997 Martin Mares + * + * This software may be freely distributed and used according to the terms + * of the GNU Lesser General Public License. */ -#include -#include +#include "lib/lib.h" -#include "lib.h" +#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); }