Skip to content

Commit 66ffa1c

Browse files
committed
Use single typedef for curl callbacks
There's no value in making these separate types.
1 parent e69a65a commit 66ffa1c

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

ext/curl/curl_private.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@ typedef struct {
6666
zval func_name;
6767
zend_fcall_info_cache fci_cache;
6868
int method;
69-
} php_curl_progress, php_curl_fnmatch, php_curlm_server_push;
69+
} php_curl_callback;
7070

7171
typedef struct {
7272
php_curl_write *write;
7373
php_curl_write *write_header;
7474
php_curl_read *read;
7575
zval std_err;
76-
php_curl_progress *progress;
76+
php_curl_callback *progress;
7777
#if LIBCURL_VERSION_NUM >= 0x071500 /* Available since 7.21.0 */
78-
php_curl_fnmatch *fnmatch;
78+
php_curl_callback *fnmatch;
7979
#endif
8080
} php_curl_handlers;
8181

@@ -112,7 +112,7 @@ typedef struct {
112112
#define CURLOPT_SAFE_UPLOAD -1
113113

114114
typedef struct {
115-
php_curlm_server_push *server_push;
115+
php_curl_callback *server_push;
116116
} php_curlm_handlers;
117117

118118
typedef struct {

ext/curl/interface.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
14101410
static int curl_fnmatch(void *ctx, const char *pattern, const char *string)
14111411
{
14121412
php_curl *ch = (php_curl *) ctx;
1413-
php_curl_fnmatch *t = ch->handlers->fnmatch;
1413+
php_curl_callback *t = ch->handlers->fnmatch;
14141414
int rval = CURL_FNMATCHFUNC_FAIL;
14151415
switch (t->method) {
14161416
case PHP_CURL_USER: {
@@ -1455,7 +1455,7 @@ static int curl_fnmatch(void *ctx, const char *pattern, const char *string)
14551455
static size_t curl_progress(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
14561456
{
14571457
php_curl *ch = (php_curl *)clientp;
1458-
php_curl_progress *t = ch->handlers->progress;
1458+
php_curl_callback *t = ch->handlers->progress;
14591459
size_t rval = 0;
14601460

14611461
#if PHP_CURL_DEBUG
@@ -1923,7 +1923,7 @@ void _php_setup_easy_copy_handlers(php_curl *ch, php_curl *source)
19231923
curl_easy_setopt(ch->cp, CURLOPT_WRITEHEADER, (void *) ch);
19241924

19251925
if (source->handlers->progress) {
1926-
ch->handlers->progress = ecalloc(1, sizeof(php_curl_progress));
1926+
ch->handlers->progress = ecalloc(1, sizeof(php_curl_callback));
19271927
if (!Z_ISUNDEF(source->handlers->progress->func_name)) {
19281928
ZVAL_COPY(&ch->handlers->progress->func_name, &source->handlers->progress->func_name);
19291929
}
@@ -1932,7 +1932,7 @@ void _php_setup_easy_copy_handlers(php_curl *ch, php_curl *source)
19321932
}
19331933

19341934
if (source->handlers->fnmatch) {
1935-
ch->handlers->fnmatch = ecalloc(1, sizeof(php_curl_fnmatch));
1935+
ch->handlers->fnmatch = ecalloc(1, sizeof(php_curl_callback));
19361936
if (!Z_ISUNDEF(source->handlers->fnmatch->func_name)) {
19371937
ZVAL_COPY(&ch->handlers->fnmatch->func_name, &source->handlers->fnmatch->func_name);
19381938
}
@@ -2737,7 +2737,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue, bool i
27372737
curl_easy_setopt(ch->cp, CURLOPT_PROGRESSFUNCTION, curl_progress);
27382738
curl_easy_setopt(ch->cp, CURLOPT_PROGRESSDATA, ch);
27392739
if (ch->handlers->progress == NULL) {
2740-
ch->handlers->progress = ecalloc(1, sizeof(php_curl_progress));
2740+
ch->handlers->progress = ecalloc(1, sizeof(php_curl_callback));
27412741
} else if (!Z_ISUNDEF(ch->handlers->progress->func_name)) {
27422742
zval_ptr_dtor(&ch->handlers->progress->func_name);
27432743
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
28462846
curl_easy_setopt(ch->cp, CURLOPT_FNMATCH_FUNCTION, curl_fnmatch);
28472847
curl_easy_setopt(ch->cp, CURLOPT_FNMATCH_DATA, ch);
28482848
if (ch->handlers->fnmatch == NULL) {
2849-
ch->handlers->fnmatch = ecalloc(1, sizeof(php_curl_fnmatch));
2849+
ch->handlers->fnmatch = ecalloc(1, sizeof(php_curl_callback));
28502850
} else if (!Z_ISUNDEF(ch->handlers->fnmatch->func_name)) {
28512851
zval_ptr_dtor(&ch->handlers->fnmatch->func_name);
28522852
ch->handlers->fnmatch->fci_cache = empty_fcall_info_cache;

ext/curl/multi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ static int _php_server_push_callback(CURL *parent_ch, CURL *easy, size_t num_hea
370370
php_curl *parent;
371371
php_curlm *mh = (php_curlm *)userp;
372372
size_t rval = CURL_PUSH_DENY;
373-
php_curlm_server_push *t = mh->handlers->server_push;
373+
php_curl_callback *t = mh->handlers->server_push;
374374
zval *pz_parent_ch = NULL;
375375
zval pz_ch;
376376
zval headers;
@@ -460,7 +460,7 @@ static int _php_curl_multi_setopt(php_curlm *mh, zend_long option, zval *zvalue,
460460
#if LIBCURL_VERSION_NUM > 0x072D00 /* Available since 7.45.0 */
461461
case CURLMOPT_PUSHFUNCTION:
462462
if (mh->handlers->server_push == NULL) {
463-
mh->handlers->server_push = ecalloc(1, sizeof(php_curlm_server_push));
463+
mh->handlers->server_push = ecalloc(1, sizeof(php_curl_callback));
464464
} else if (!Z_ISUNDEF(mh->handlers->server_push->func_name)) {
465465
zval_ptr_dtor(&mh->handlers->server_push->func_name);
466466
mh->handlers->server_push->fci_cache = empty_fcall_info_cache;

0 commit comments

Comments
 (0)