* 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. */
| 109 | * the program dies. |
| 110 | */ |
| 111 | void *xmemdupz(const void *data, size_t len) |
| 112 | { |
| 113 | return memcpy(xmallocz(len), data, len); |
| 114 | } |
| 115 | |
| 116 | char *xstrndup(const char *str, size_t len) |
| 117 | { |