| 71 | /* internal function to do the actual memory allocation */ |
| 72 | |
| 73 | static string_t *new_string_pool(string_alloc_t *a_str) { |
| 74 | string_t *str; |
| 75 | |
| 76 | str = realloc(a_str->strings, (a_str->nstrings + 1) * sizeof(*a_str->strings)); |
| 77 | |
| 78 | if (NULL == str) return NULL; |
| 79 | |
| 80 | a_str->strings = str; |
| 81 | str = &a_str->strings[a_str->nstrings]; |
| 82 | |
| 83 | str->str = malloc(a_str->max_length);; |
| 84 | |
| 85 | if (NULL == str->str) return NULL; |
| 86 | |
| 87 | str->used = 0; |
| 88 | a_str->nstrings++; |
| 89 | |
| 90 | return str; |
| 91 | } |
| 92 | |
| 93 | |
| 94 | /* free allocated memory */ |