/* * UCW Library -- String Allocation * * (c) 1997 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. */ #include #include char * xstrdup(const char *s) { if (!s) return NULL; uint l = strlen(s) + 1; return memcpy(xmalloc(l), s, l); }