* "Safe" wrapper around strdup(). */
| 82 | * "Safe" wrapper around strdup(). |
| 83 | */ |
| 84 | char * |
| 85 | pg_strdup(const char *in) |
| 86 | { |
| 87 | char *tmp; |
| 88 | |
| 89 | if (!in) |
| 90 | { |
| 91 | fprintf(stderr, |
| 92 | _("cannot duplicate null pointer (internal error)\n")); |
| 93 | exit(EXIT_FAILURE); |
| 94 | } |
| 95 | tmp = strdup(in); |
| 96 | if (!tmp) |
| 97 | { |
| 98 | fprintf(stderr, _("out of memory\n")); |
| 99 | exit(EXIT_FAILURE); |
| 100 | } |
| 101 | return tmp; |
| 102 | } |
| 103 | |
| 104 | void |
| 105 | pg_free(void *ptr) |
no outgoing calls