X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Falloc_str.c;h=ab7b467213b4c0303abfca4046e846648e94078b;hb=149855f3744354726d12be1a15f4eb6e009e6314;hp=2b03eb2cdc952ee1daf3061f1bc6e9e99be72957;hpb=49ed04e2e93a6a5b01058638224621d5c07db01c;p=libucw.git diff --git a/lib/alloc_str.c b/lib/alloc_str.c index 2b03eb2c..ab7b4672 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 * @@ -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); }