Mercurial > hg > th-libs
diff th_util.c @ 192:7d25d43a3ce2
Add new function th_free_r(void **ptr) that calls th_free(*ptr) and sets *ptr to NULL.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 11 Feb 2016 16:10:31 +0200 |
parents | 2b07e452fd78 |
children | 87dac812cac4 |
line wrap: on
line diff
--- a/th_util.c Thu Feb 11 16:09:12 2016 +0200 +++ b/th_util.c Thu Feb 11 16:10:31 2016 +0200 @@ -233,6 +233,16 @@ } +void th_free_r(void **p) +{ + if (p != NULL) + { + th_free(*p); + *p = NULL; + } +} + + /* Doubly linked list handling * * In this implementation first node's prev points to last node of the list,