]> mj.ucw.cz Git - libucw.git/blobdiff - lib/alloc_str.c
Adapted to new unicode includes.
[libucw.git] / lib / alloc_str.c
index baf5f5adf94cfc844da495e49de1b95dd6055e58..45ea49125d9eb85ed5d4f16276e5ba644a9bcdbe 100644 (file)
@@ -2,6 +2,9 @@
  *     Sherlock Library -- String Allocation
  *
  *     (c) 1997 Martin Mares <mj@ucw.cz>
+ *
+ *     This software may be freely distributed and used according to the terms
+ *     of the GNU Lesser General Public License.
  */
 
 #include "lib/lib.h"
@@ -9,10 +12,8 @@
 #include <string.h>
 
 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);
 }