-#define http_curl_freestr() \
- zend_llist_clean(&HTTP_G(to_free))
-
-#define http_curl_initbuf() \
- http_curl_initbuf_ex(0)
-
-#define http_curl_initbuf_ex(chunk_size) \
- { \
- size_t size = chunk_size; \
- if (size < 1) { \
- size = HTTP_CURLBUF_SIZE; \
- } \
- http_curl_freebuf(); \
- HTTP_G(curlbuf).data = emalloc(size); \
- HTTP_G(curlbuf).free = size; \
- HTTP_G(curlbuf).size = size; \
- }
-
-#define http_curl_freebuf() \
- if (HTTP_G(curlbuf).data) { \
- efree(HTTP_G(curlbuf).data); \
- HTTP_G(curlbuf).data = NULL; \
- } \
- HTTP_G(curlbuf).used = 0; \
- HTTP_G(curlbuf).free = 0; \
- HTTP_G(curlbuf).size = 0;
-
-#define http_curl_copybuf(data, size) \
- *size = HTTP_G(curlbuf).used; \
- *data = ecalloc(1, HTTP_G(curlbuf).used + 1); \
- memcpy(*data, HTTP_G(curlbuf).data, HTTP_G(curlbuf).used);
-
-#define http_curl_sizebuf(for_size) \
- { \
- size_t size = (for_size); \
- if (size > HTTP_G(curlbuf).free) { \
- size_t bsize = HTTP_G(curlbuf).size; \
- while (size > bsize) { \
- bsize *= 2; \
- } \
- HTTP_G(curlbuf).data = erealloc(HTTP_G(curlbuf).data, HTTP_G(curlbuf).used + bsize); \
- HTTP_G(curlbuf).free += bsize; \
- } \
- }
-