Extend the given buffer only if needed */
| 1000 | |
| 1001 | /* Extend the given buffer only if needed */ |
| 1002 | static inline int pkg_str_extend(str *in, int size) |
| 1003 | { |
| 1004 | char *p; |
| 1005 | |
| 1006 | /* do not check for !in->s here, as it's better |
| 1007 | * to crash sooner on a corrupt @in string (e.g. {NULL, 172}) */ |
| 1008 | if (in->len < size) { |
| 1009 | p = pkg_realloc(in->s, size); |
| 1010 | if (!p) { |
| 1011 | LM_ERR("oom\n"); |
| 1012 | return -1; |
| 1013 | } |
| 1014 | |
| 1015 | in->s = p; |
| 1016 | in->len = size; |
| 1017 | } |
| 1018 | |
| 1019 | return 0; |
| 1020 | } |
| 1021 | |
| 1022 | /* |
| 1023 | * Ensure "dst" matches the content of "src" without leaking memory |
no outgoing calls
no test coverage detected