X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Falloc_str.c;h=05e803c737ef1b373b7d731fe6ff620e7202ddb9;hb=3bb641c18d60f38d6e646211aa5c6a4b63ba9180;hp=0153887e252bcd001a633d7ff5f98e70e626914a;hpb=5b53087fa5a07ff89d34cf3bf3bc1b28809f05c2;p=libucw.git diff --git a/lib/alloc_str.c b/lib/alloc_str.c index 0153887e..05e803c7 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" -byte * -stralloc(byte *s) +#include + +char * +xstrdup(const char *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); }