diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-01-04 15:19:01 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-01-04 15:19:01 +0100 |
commit | 66ffa1c9d22dab0f34ef9e70d2f60bf7af820f7a (patch) | |
tree | a54c0bfeec4244799ef520fa4227c7e0384866c1 | |
parent | e69a65a2b572a3e2335804bf639865b300f66dd4 (diff) | |
download | php-git-66ffa1c9d22dab0f34ef9e70d2f60bf7af820f7a.tar.gz |
Use single typedef for curl callbacks
There's no value in making these separate types.
-rw-r--r-- | ext/curl/curl_private.h | 8 | ||||
-rw-r--r-- | ext/curl/interface.c | 12 | ||||
-rw-r--r-- | ext/curl/multi.c | 4 |
3 files changed, 12 insertions, 12 deletions
diff --git a/ext/curl/curl_private.h b/ext/curl/curl_private.h index 6ed2eba3c3..e6c71dbb88 100644 --- a/ext/curl/curl_private.h +++ b/ext/curl/curl_private.h @@ -66,16 +66,16 @@ typedef struct { zval func_name; zend_fcall_info_cache fci_cache; int method; -} php_curl_progress, php_curl_fnmatch, php_curlm_server_push; +} php_curl_callback; typedef struct { php_curl_write *write; php_curl_write *write_header; php_curl_read *read; zval std_err; - php_curl_progress *progress; + php_curl_callback *progress; #if LIBCURL_VERSION_NUM >= 0x071500 /* Available since 7.21.0 */ - php_curl_fnmatch *fnmatch; + php_curl_callback *fnmatch; #endif } php_curl_handlers; @@ -112,7 +112,7 @@ typedef struct { #define CURLOPT_SAFE_UPLOAD -1 typedef struct { - php_curlm_server_push *server_push; + php_curl_callback *server_push; } php_curlm_handlers; typedef struct { diff --git a/ext/curl/interface.c b/ext/curl/interface.c index f01f6f775a..f8443cdd51 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -1410,7 +1410,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx) static int curl_fnmatch(void *ctx, const char *pattern, const char *string) { php_curl *ch = (php_curl *) ctx; - php_curl_fnmatch *t = ch->handlers->fnmatch; + php_curl_callback *t = ch->handlers->fnmatch; int rval = CURL_FNMATCHFUNC_FAIL; switch (t->method) { case PHP_CURL_USER: { @@ -1455,7 +1455,7 @@ static int curl_fnmatch(void *ctx, const char *pattern, const char *string) static size_t curl_progress(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) { php_curl *ch = (php_curl *)clientp; - php_curl_progress *t = ch->handlers->progress; + php_curl_callback *t = ch->handlers->progress; size_t rval = 0; #if PHP_CURL_DEBUG @@ -1923,7 +1923,7 @@ void _php_setup_easy_copy_handlers(php_curl *ch, php_curl *source) curl_easy_setopt(ch->cp, CURLOPT_WRITEHEADER, (void *) ch); if (source->handlers->progress) { - ch->handlers->progress = ecalloc(1, sizeof(php_curl_progress)); + ch->handlers->progress = ecalloc(1, sizeof(php_curl_callback)); if (!Z_ISUNDEF(source->handlers->progress->func_name)) { ZVAL_COPY(&ch->handlers->progress->func_name, &source->handlers->progress->func_name); } @@ -1932,7 +1932,7 @@ void _php_setup_easy_copy_handlers(php_curl *ch, php_curl *source) } if (source->handlers->fnmatch) { - ch->handlers->fnmatch = ecalloc(1, sizeof(php_curl_fnmatch)); + ch->handlers->fnmatch = ecalloc(1, sizeof(php_curl_callback)); if (!Z_ISUNDEF(source->handlers->fnmatch->func_name)) { ZVAL_COPY(&ch->handlers->fnmatch->func_name, &source->handlers->fnmatch->func_name); } @@ -2737,7 +2737,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue, bool i curl_easy_setopt(ch->cp, CURLOPT_PROGRESSFUNCTION, curl_progress); curl_easy_setopt(ch->cp, CURLOPT_PROGRESSDATA, ch); if (ch->handlers->progress == NULL) { - ch->handlers->progress = ecalloc(1, sizeof(php_curl_progress)); + ch->handlers->progress = ecalloc(1, sizeof(php_curl_callback)); } else if (!Z_ISUNDEF(ch->handlers->progress->func_name)) { zval_ptr_dtor(&ch->handlers->progress->func_name); ch->handlers->progress->fci_cache = empty_fcall_info_cache; @@ -2846,7 +2846,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue, bool i curl_easy_setopt(ch->cp, CURLOPT_FNMATCH_FUNCTION, curl_fnmatch); curl_easy_setopt(ch->cp, CURLOPT_FNMATCH_DATA, ch); if (ch->handlers->fnmatch == NULL) { - ch->handlers->fnmatch = ecalloc(1, sizeof(php_curl_fnmatch)); + ch->handlers->fnmatch = ecalloc(1, sizeof(php_curl_callback)); } else if (!Z_ISUNDEF(ch->handlers->fnmatch->func_name)) { zval_ptr_dtor(&ch->handlers->fnmatch->func_name); ch->handlers->fnmatch->fci_cache = empty_fcall_info_cache; diff --git a/ext/curl/multi.c b/ext/curl/multi.c index e717fd5d9e..772b53ecc9 100644 --- a/ext/curl/multi.c +++ b/ext/curl/multi.c @@ -370,7 +370,7 @@ static int _php_server_push_callback(CURL *parent_ch, CURL *easy, size_t num_hea php_curl *parent; php_curlm *mh = (php_curlm *)userp; size_t rval = CURL_PUSH_DENY; - php_curlm_server_push *t = mh->handlers->server_push; + php_curl_callback *t = mh->handlers->server_push; zval *pz_parent_ch = NULL; zval pz_ch; zval headers; @@ -460,7 +460,7 @@ static int _php_curl_multi_setopt(php_curlm *mh, zend_long option, zval *zvalue, #if LIBCURL_VERSION_NUM > 0x072D00 /* Available since 7.45.0 */ case CURLMOPT_PUSHFUNCTION: if (mh->handlers->server_push == NULL) { - mh->handlers->server_push = ecalloc(1, sizeof(php_curlm_server_push)); + mh->handlers->server_push = ecalloc(1, sizeof(php_curl_callback)); } else if (!Z_ISUNDEF(mh->handlers->server_push->func_name)) { zval_ptr_dtor(&mh->handlers->server_push->func_name); mh->handlers->server_push->fci_cache = empty_fcall_info_cache; |