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