X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_curl_api.c;fp=http_curl_api.c;h=3dc462cdc95a3f8d539121b0efdfc2d23fcd4802;hp=6e96940daf7ad77da0c906f18286d4a0ab9a4623;hb=fc73263920c3b5af2f0266d51cd80c0a50017807;hpb=0c8a4e49249dc2e9091f408af7a88aa0f73ac8b2 diff --git a/http_curl_api.c b/http_curl_api.c index 6e96940..3dc462c 100644 --- a/http_curl_api.c +++ b/http_curl_api.c @@ -45,6 +45,11 @@ ZEND_DECLARE_MODULE_GLOBALS(http) # define http_curl_reset(ch) #endif +/* FIXXME: correct version where strerror is supported! */ +#if LIBCURL_VERSION_NUM < 0x070b01 +# define curl_easy_strerror(code) "unkown error" +#endif + #define http_curl_startup(ch, clean_curl, URL, options) \ if (!ch) { \ if (!(ch = curl_easy_init())) { \ @@ -79,11 +84,15 @@ ZEND_DECLARE_MODULE_GLOBALS(http) #define http_curl_freestr() \ zend_llist_clean(&HTTP_G(to_free)) -#define http_curl_initbuf() http_curl_initbuf_ex(0) +#define http_curl_initbuf() \ + http_curl_initbuf_ex(0) #define http_curl_initbuf_ex(chunk_size) \ { \ - size_t size = (chunk_size > 0) ? chunk_size : HTTP_CURLBUF_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; \