MCPcopy Create free account
hub / github.com/dillo-browser/dillo / dStr_resize

Function dStr_resize

dlib/dlib.c:234–248  ·  view source on GitHub ↗

* Private allocator */

Source from the content-addressed store, hash-verified

232 * Private allocator
233 */
234static 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.

Callers 4

dStr_sized_newFunction · 0.85
dStr_fitFunction · 0.85
dStr_insert_lFunction · 0.85
dStr_vsprintfaFunction · 0.85

Calls 2

dReallocFunction · 0.85
dFreeFunction · 0.85

Tested by

no test coverage detected