comparison th_datastruct.c @ 733:79d06eb6d39f

Rename "allocated" field to "is_allocated" in some structures.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 07 Dec 2022 11:57:43 +0200
parents d190dccc3ee6
children 31bc1ed07cf5
comparison
equal deleted inserted replaced
732:d190dccc3ee6 733:79d06eb6d39f
316 { 316 {
317 th_free(*buf); 317 th_free(*buf);
318 return res; 318 return res;
319 } 319 }
320 320
321 (*buf)->allocated = TRUE; 321 (*buf)->is_allocated = TRUE;
322 322
323 return THERR_OK; 323 return THERR_OK;
324 } 324 }
325 325
326 326
347 buf->deallocator(buf->data[i]); 347 buf->deallocator(buf->data[i]);
348 } 348 }
349 349
350 th_free(buf->data); 350 th_free(buf->data);
351 351
352 if (buf->allocated) 352 if (buf->is_allocated)
353 th_free(buf); 353 th_free(buf);
354 } 354 }
355 355
356 356
357 void th_ringbuf_add(th_ringbuf_t *buf, void *ptr) 357 void th_ringbuf_add(th_ringbuf_t *buf, void *ptr)
389 389
390 if ((buf = th_malloc(sizeof(th_growbuf_t))) == NULL) 390 if ((buf = th_malloc(sizeof(th_growbuf_t))) == NULL)
391 return NULL; 391 return NULL;
392 392
393 th_growbuf_init(buf, mingrow); 393 th_growbuf_init(buf, mingrow);
394 buf->allocated = TRUE; 394 buf->is_allocated = TRUE;
395 395
396 return buf; 396 return buf;
397 } 397 }
398 398
399 399
400 void th_growbuf_free(th_growbuf_t *buf) 400 void th_growbuf_free(th_growbuf_t *buf)
401 { 401 {
402 th_free(buf->data); 402 th_free(buf->data);
403 403
404 if (buf->allocated) 404 if (buf->is_allocated)
405 th_free(buf); 405 th_free(buf);
406 } 406 }
407 407
408 408
409 BOOL th_growbuf_grow(th_growbuf_t *buf, const size_t amount) 409 BOOL th_growbuf_grow(th_growbuf_t *buf, const size_t amount)