]> mj.ucw.cz Git - libucw.git/blobdiff - lib/alloc_str.c
Don't forget to increase run counter.
[libucw.git] / lib / alloc_str.c
index 7c9f92decdd999db49583c782ae8c240953f0d2d..ab7b467213b4c0303abfca4046e846648e94078b 100644 (file)
@@ -1,19 +1,19 @@
 /*
- *     Sherlock Library -- String Allocation
+ *     UCW Library -- String Allocation
  *
- *     (c) 1997 Martin Mares, <mj@atrey.karlin.mff.cuni.cz>
+ *     (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 <stdio.h>
-#include <string.h>
+#include "lib/lib.h"
 
-#include "lib.h"
+#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);
 }