* Duplicate a string. */
| 49 | * Duplicate a string. |
| 50 | */ |
| 51 | char *strDup(const char *old_str, size_t n) |
| 52 | { |
| 53 | char *new_str = strndup(old_str, n); |
| 54 | if (new_str == nullptr) |
| 55 | error("failed to duplicate string \"%s\": %s", old_str, |
| 56 | strerror(ENOMEM)); |
| 57 | return new_str; |
| 58 | } |
| 59 | |
| 60 | /* |
| 61 | * Create a persistent copy of a string. |
no test coverage detected