]> mj.ucw.cz Git - libucw.git/blobdiff - lib/alloc_str.c
Allow typed configuration items. (This is the only way to get constructs
[libucw.git] / lib / alloc_str.c
index 2b03eb2cdc952ee1daf3061f1bc6e9e99be72957..ab7b467213b4c0303abfca4046e846648e94078b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *     Sherlock Library -- String Allocation
+ *     UCW Library -- String Allocation
  *
  *     (c) 1997 Martin Mares <mj@ucw.cz>
  *
 #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);
 }