X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Falloc_str.c;h=05e803c737ef1b373b7d731fe6ff620e7202ddb9;hb=1f71ba3ef3df61706d7aee1ffa981cf6fdee7c4e;hp=2b03eb2cdc952ee1daf3061f1bc6e9e99be72957;hpb=49ed04e2e93a6a5b01058638224621d5c07db01c;p=libucw.git diff --git a/lib/alloc_str.c b/lib/alloc_str.c index 2b03eb2c..05e803c7 100644 --- a/lib/alloc_str.c +++ b/lib/alloc_str.c @@ -1,5 +1,5 @@ /* - * Sherlock Library -- String Allocation + * UCW Library -- String Allocation * * (c) 1997 Martin Mares * @@ -11,11 +11,9 @@ #include -byte * -stralloc(byte *s) +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); }