Skip to content

Commit

Permalink
ext/curl: Update libcurl ver comparison preprocessors to contain huma…
Browse files Browse the repository at this point in the history
…n-friendly version names

Adds missing human-friendly version number comments where missing.
  • Loading branch information
Ayesh committed Jan 31, 2024
1 parent fee6760 commit 4cea17f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ext/curl/curl_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ typedef struct {
php_curl_callback *progress;
php_curl_callback *xferinfo;
php_curl_callback *fnmatch;
#if LIBCURL_VERSION_NUM >= 0x075400
#if LIBCURL_VERSION_NUM >= 0x075400 /* Available since 7.84.0 */
php_curl_callback *sshhostkey;
#endif
} php_curl_handlers;
Expand Down
22 changes: 11 additions & 11 deletions ext/curl/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,20 +293,20 @@ PHP_MINFO_FUNCTION(curl)
{"HTTPS_PROXY", CURL_VERSION_HTTPS_PROXY},
{"MULTI_SSL", CURL_VERSION_MULTI_SSL},
{"BROTLI", CURL_VERSION_BROTLI},
#if LIBCURL_VERSION_NUM >= 0x074001 /* 7.64.1 */
#if LIBCURL_VERSION_NUM >= 0x074001 /* Available since 7.64.1 */
{"ALTSVC", CURL_VERSION_ALTSVC},
#endif
#if LIBCURL_VERSION_NUM >= 0x074200 /* 7.66.0 */
#if LIBCURL_VERSION_NUM >= 0x074200 /* Available since 7.66.0 */
{"HTTP3", CURL_VERSION_HTTP3},
#endif
#if LIBCURL_VERSION_NUM >= 0x074800 /* 7.72.0 */
#if LIBCURL_VERSION_NUM >= 0x074800 /* Available since 7.72.0 */
{"UNICODE", CURL_VERSION_UNICODE},
{"ZSTD", CURL_VERSION_ZSTD},
#endif
#if LIBCURL_VERSION_NUM >= 0x074a00 /* 7.74.0 */
#if LIBCURL_VERSION_NUM >= 0x074a00 /* Available since 7.74.0 */
{"HSTS", CURL_VERSION_HSTS},
#endif
#if LIBCURL_VERSION_NUM >= 0x074c00 /* 7.76.0 */
#if LIBCURL_VERSION_NUM >= 0x074c00 /* Available since 7.76.0 */
{"GSASL", CURL_VERSION_GSASL},
#endif
{NULL, 0}
Expand Down Expand Up @@ -499,7 +499,7 @@ static HashTable *curl_get_gc(zend_object *object, zval **table, int *n)
zend_get_gc_buffer_add_zval(gc_buffer, &curl->handlers.fnmatch->func_name);
}

#if LIBCURL_VERSION_NUM >= 0x075400
#if LIBCURL_VERSION_NUM >= 0x075400 /* Available since 7.84.0 */
if (curl->handlers.sshhostkey) {
zend_get_gc_buffer_add_zval(gc_buffer, &curl->handlers.sshhostkey->func_name);
}
Expand Down Expand Up @@ -756,7 +756,7 @@ static size_t curl_xferinfo(void *clientp, curl_off_t dltotal, curl_off_t dlnow,
}
/* }}} */

#if LIBCURL_VERSION_NUM >= 0x075400
#if LIBCURL_VERSION_NUM >= 0x075400 /* Available since 7.84.0 */
static int curl_ssh_hostkeyfunction(void *clientp, int keytype, const char *key, size_t keylen)
{
php_curl *ch = (php_curl *)clientp;
Expand Down Expand Up @@ -1057,7 +1057,7 @@ void init_curl_handle(php_curl *ch)
ch->handlers.progress = NULL;
ch->handlers.xferinfo = NULL;
ch->handlers.fnmatch = NULL;
#if LIBCURL_VERSION_NUM >= 0x075400
#if LIBCURL_VERSION_NUM >= 0x075400 /* Available since 7.84.0 */
ch->handlers.sshhostkey = NULL;
#endif
ch->clone = emalloc(sizeof(uint32_t));
Expand Down Expand Up @@ -1233,7 +1233,7 @@ void _php_setup_easy_copy_handlers(php_curl *ch, php_curl *source)
_php_copy_callback(ch, &ch->handlers.progress, source->handlers.progress, CURLOPT_PROGRESSDATA);
_php_copy_callback(ch, &ch->handlers.xferinfo, source->handlers.xferinfo, CURLOPT_XFERINFODATA);
_php_copy_callback(ch, &ch->handlers.fnmatch, source->handlers.fnmatch, CURLOPT_FNMATCH_DATA);
#if LIBCURL_VERSION_NUM >= 0x075400
#if LIBCURL_VERSION_NUM >= 0x075400 /* Available since 7.84.0 */
_php_copy_callback(ch, &ch->handlers.sshhostkey, source->handlers.sshhostkey, CURLOPT_SSH_HOSTKEYDATA);
#endif

Expand Down Expand Up @@ -2783,7 +2783,7 @@ static void curl_free_obj(zend_object *object)
_php_curl_free_callback(ch->handlers.progress);
_php_curl_free_callback(ch->handlers.xferinfo);
_php_curl_free_callback(ch->handlers.fnmatch);
#if LIBCURL_VERSION_NUM >= 0x075400
#if LIBCURL_VERSION_NUM >= 0x075400 /* Available since 7.84.0 */
_php_curl_free_callback(ch->handlers.sshhostkey);
#endif

Expand Down Expand Up @@ -2866,7 +2866,7 @@ static void _php_curl_reset_handlers(php_curl *ch)
ch->handlers.fnmatch = NULL;
}

#if LIBCURL_VERSION_NUM >= 0x075400
#if LIBCURL_VERSION_NUM >= 0x075400 /* Available since 7.84.0 */
if (ch->handlers.sshhostkey) {
zval_ptr_dtor(&ch->handlers.sshhostkey->func_name);
efree(ch->handlers.sshhostkey);
Expand Down
2 changes: 1 addition & 1 deletion ext/curl/multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ static bool _php_curl_multi_setopt(php_curlm *mh, zend_long option, zval *zvalue
zend_long lval = zval_get_long(zvalue);

if (option == CURLMOPT_PIPELINING && (lval & 1)) {
#if LIBCURL_VERSION_NUM >= 0x073e00 /* 7.62.0 */
#if LIBCURL_VERSION_NUM >= 0x073e00 /* Available since 7.62.0 */
php_error_docref(NULL, E_WARNING, "CURLPIPE_HTTP1 is no longer supported");
#else
php_error_docref(NULL, E_DEPRECATED, "CURLPIPE_HTTP1 is deprecated");
Expand Down

0 comments on commit 4cea17f

Please sign in to comment.