* Private allocator */
| 232 | * Private allocator |
| 233 | */ |
| 234 | static void dStr_resize(Dstr *ds, int n_sz, int keep) |
| 235 | { |
| 236 | if (n_sz >= 0) { |
| 237 | if (keep && n_sz > ds->len) { |
| 238 | ds->str = (Dstr_char_t*) dRealloc (ds->str, n_sz*sizeof(Dstr_char_t)); |
| 239 | ds->sz = n_sz; |
| 240 | } else { |
| 241 | dFree(ds->str); |
| 242 | ds->str = dNew(Dstr_char_t, n_sz); |
| 243 | ds->sz = n_sz; |
| 244 | ds->len = 0; |
| 245 | ds->str[0] = 0; |
| 246 | } |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | /** |
| 251 | * Create a new string with a given size. |
no test coverage detected