On Wed, Jan 13, 2010 at 14:19, Ilari Liusvaara <ilari.liusvaara@xxxxxxxxxxx> wrote: > +char *copy_alloc(const char *str, size_t len) > +{ > + char *copy; > + > + copy = xmalloc(len + 1); > + copy[len] = 0; > + strncpy(copy, str, len); > + return copy; > +} Some know this code as strndup(3): http://linux.die.net/man/3/strndup -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html