| 99 | |
| 100 | static void *xrealloc(void *p, size_t n) { |
| 101 | void *q = realloc(p, n ? n : 1); |
| 102 | if (!q) die("out of memory"); |
| 103 | return q; |
| 104 | } |
| 105 | |
| 106 | static char *xstrdup(const char *s) { |
| 107 | size_t n = strlen(s); |
| 108 | char *p = xmalloc(n + 1); |
| 109 | memcpy(p, s, n + 1); |
no test coverage detected