- add package.xml generated by $pecl pickle
[m6w6/ext-http] / phpstr / phpstr.c
index 8d8df3ea25f383cf1e9ec1efe9f0b73d495a4654..70673a92ed7c4fd4c8b5f737b75442b98a4d73c9 100644 (file)
@@ -4,10 +4,6 @@
 #include "php.h"
 #include "phpstr.h"
 
-#ifndef PHPSTR_DEFAULT_SIZE
-#define PHPSTR_DEFAULT_SIZE 256
-#endif
-
 PHPSTR_API phpstr *phpstr_init_ex(phpstr *buf, size_t chunk_size, zend_bool pre_alloc)
 {
        if (!buf) {
@@ -235,19 +231,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;
        }
 }