]> mj.ucw.cz Git - libucw.git/blobdiff - lib/alloc_str.c
fixed SHERLOCK_VERSION
[libucw.git] / lib / alloc_str.c
index baf5f5adf94cfc844da495e49de1b95dd6055e58..05e803c737ef1b373b7d731fe6ff620e7202ddb9 100644 (file)
@@ -1,18 +1,19 @@
 /*
- *     Sherlock Library -- String Allocation
+ *     UCW 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"
 
 #include <string.h>
 
-byte *
-stralloc(byte *s)
+char *
+xstrdup(const char *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);
 }