}
}
+PHPSTR_API void phpstr_reset(phpstr *buf)
+{
+ buf->free += buf->used;
+ buf->used = 0;
+}
+
PHPSTR_API void phpstr_dtor(phpstr *buf)
{
STR_SET(buf->data, NULL);
if (!chunk_size) {
phpstr_data(storage, chunk, &chunk_size);
- phpstr_free(&storage);
+ phpstr_free(s);
return chunk_size;
}
while (got = phpstr_chunk_buffer(s, data, data_len, &chunk, chunk_len)) {
passthru(chunk, got TSRMLS_CC);
- efree(chunk);
- data = NULL;
- data_len = 0;
if (!chunk_len) {
+ /* we already got the last chunk,
+ and freed all resources */
break;
}
+ data = NULL;
+ data_len = 0;
+ STR_SET(chunk, NULL);
}
+ STR_FREE(chunk);
}
/*