X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=phpstr%2Fphpstr.c;fp=phpstr%2Fphpstr.c;h=acee06fde4df9f39197b3302a79c1811d307f4c5;hp=8d8df3ea25f383cf1e9ec1efe9f0b73d495a4654;hb=0d925a2820b9d75b8e32c451fd400863e51e22fe;hpb=1d37eec22d2a073acd8785431621c26c2312a246 diff --git a/phpstr/phpstr.c b/phpstr/phpstr.c index 8d8df3e..acee06f 100644 --- a/phpstr/phpstr.c +++ b/phpstr/phpstr.c @@ -235,19 +235,17 @@ PHPSTR_API int phpstr_cmp(phpstr *left, phpstr *right) PHPSTR_API void phpstr_dtor(phpstr *buf) { - if (buf->data) { - efree(buf->data); - buf->data = NULL; - } + STR_SET(buf->data, NULL); buf->used = 0; buf->free = 0; } -PHPSTR_API void phpstr_free(phpstr *buf) +PHPSTR_API void phpstr_free(phpstr **buf) { - if (buf) { - phpstr_dtor(buf); - efree(buf); + if (*buf) { + phpstr_dtor(*buf); + efree(*buf); + *buf = NULL; } }