/* xmemdupz() allocates (len + 1) bytes of memory, duplicates "len" bytes of "data" to the allocated memory, zero terminates the allocated memory, and returns a pointer to the allocated memory. If the allocation fails, the program dies.  */
void* xmemdupz(const void *data, size_t len)
/* xmemdupz() allocates (len + 1) bytes of memory, duplicates "len" bytes of "data" to the allocated memory, zero terminates the allocated memory, and returns a pointer to the allocated memory. If the allocation fails, the program dies.  */
void* xmemdupz(const void *data, size_t len)
{
	char *p = xmalloc(len + 1);
	memcpy(p, data, len);
	p[len] = '\0';
	return p;
}