Skip to content

Commit 28afd62

Browse files
committed
Rename several identifiers
1 parent 512ce49 commit 28afd62

File tree

1 file changed

+57
-57
lines changed

1 file changed

+57
-57
lines changed

ext/curl/interface.c

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,30 +1796,30 @@ static void curl_free_post(void **post)
17961796
}
17971797
/* }}} */
17981798

1799-
struct mime_file {
1799+
struct mime_data_cb_arg {
18001800
php_curl *ch;
18011801
union {
18021802
zval postfields;
18031803
struct {
1804-
zend_string *name;
1804+
zend_string *filename;
18051805
php_stream *stream;
18061806
};
18071807
};
18081808
};
18091809

1810-
/* {{{ curl_free_stream
1810+
/* {{{ curl_free_cb_arg
18111811
*/
1812-
static void curl_free_stream(void **post)
1812+
static void curl_free_cb_arg(void **cb_arg_p)
18131813
{
1814-
struct mime_file *mime_file = (struct mime_file *) *post;
1814+
struct mime_data_cb_arg *cb_arg = (struct mime_data_cb_arg *) *cb_arg_p;
18151815

1816-
if (mime_file->ch) {
1817-
Z_DELREF(mime_file->postfields);
1816+
if (cb_arg->ch) {
1817+
Z_DELREF(cb_arg->postfields);
18181818
} else {
1819-
ZEND_ASSERT(mime_file->stream == NULL);
1820-
zend_string_release(mime_file->name);
1819+
ZEND_ASSERT(cb_arg->stream == NULL);
1820+
zend_string_release(cb_arg->filename);
18211821
}
1822-
efree(mime_file);
1822+
efree(cb_arg);
18231823
}
18241824
/* }}} */
18251825

@@ -1920,7 +1920,7 @@ php_curl *alloc_curl_handle()
19201920

19211921
zend_llist_init(&ch->to_free->str, sizeof(char *), (llist_dtor_func_t)curl_free_string, 0);
19221922
zend_llist_init(&ch->to_free->post, sizeof(struct HttpPost *), (llist_dtor_func_t)curl_free_post, 0);
1923-
zend_llist_init(&ch->to_free->stream, sizeof(struct mime_file *), (llist_dtor_func_t)curl_free_stream, 0);
1923+
zend_llist_init(&ch->to_free->stream, sizeof(struct mime_data_cb_arg *), (llist_dtor_func_t)curl_free_cb_arg, 0);
19241924

19251925
ch->to_free->slist = emalloc(sizeof(HashTable));
19261926
zend_hash_init(ch->to_free->slist, 4, NULL, curl_free_slist, 0);
@@ -2153,7 +2153,7 @@ static int rebuild_mime_structure(php_curl *ch, zval *zpostfields)
21532153
zval *prop, rv;
21542154
char *type = NULL, *filename = NULL;
21552155

2156-
struct mime_file *mime_file;
2156+
struct mime_data_cb_arg *cb_arg;
21572157

21582158

21592159
prop = zend_read_property(curl_CURLFile_class, current, "name", sizeof("name")-1, 0, &rv);
@@ -2175,27 +2175,27 @@ static int rebuild_mime_structure(php_curl *ch, zval *zpostfields)
21752175
filename = Z_STRVAL_P(prop);
21762176
}
21772177

2178-
mime_file = emalloc(sizeof *mime_file);
2179-
mime_file->ch = ch;
2180-
ZVAL_COPY(&mime_file->postfields, zpostfields);
2181-
zend_llist_add_element(&ch->to_free->stream, &mime_file);
2178+
cb_arg = emalloc(sizeof *cb_arg);
2179+
cb_arg->ch = ch;
2180+
ZVAL_COPY(&cb_arg->postfields, zpostfields);
2181+
zend_llist_add_element(&ch->to_free->stream, &cb_arg);
21822182

2183-
mime_file = emalloc(sizeof *mime_file);
2184-
mime_file->ch = NULL;
2185-
mime_file->name = zend_string_copy(postval);
2186-
mime_file->stream = NULL;
2183+
cb_arg = emalloc(sizeof *cb_arg);
2184+
cb_arg->ch = NULL;
2185+
cb_arg->filename = zend_string_copy(postval);
2186+
cb_arg->stream = NULL;
21872187
part = curl_mime_addpart(mime);
21882188
if (part == NULL) {
21892189
zend_string_release_ex(string_key, 0);
21902190
return FAILURE;
21912191
}
21922192
if ((form_error = curl_mime_name(part, ZSTR_VAL(string_key))) != CURLE_OK
2193-
|| (form_error = curl_mime_data_cb(part, -1, read_cb, seek_cb, free_cb, mime_file)) != CURLE_OK
2193+
|| (form_error = curl_mime_data_cb(part, -1, read_cb, seek_cb, free_cb, cb_arg)) != CURLE_OK
21942194
|| (form_error = curl_mime_filename(part, filename ? filename : ZSTR_VAL(postval))) != CURLE_OK
21952195
|| (form_error = curl_mime_type(part, type ? type : "application/octet-stream")) != CURLE_OK) {
21962196
error = form_error;
21972197
}
2198-
zend_llist_add_element(&ch->to_free->stream, &mime_file);
2198+
zend_llist_add_element(&ch->to_free->stream, &cb_arg);
21992199
}
22002200

22012201
zend_string_release_ex(string_key, 0);
@@ -2234,15 +2234,15 @@ static int rebuild_mime_structure(php_curl *ch, zval *zpostfields)
22342234

22352235
static HashTable *get_postfields_of_handle(php_curl *ch)
22362236
{
2237-
struct mime_file *mime_file, **mfp;
2237+
struct mime_data_cb_arg *cb_arg, **cb_arg_p;
22382238

2239-
mfp = zend_llist_get_last(&ch->to_free->stream);
2240-
while (mfp) {
2241-
mime_file = *mfp;
2242-
if (mime_file->ch == ch) {
2243-
return &mime_file->postfields;
2239+
cb_arg_p = zend_llist_get_last(&ch->to_free->stream);
2240+
while (cb_arg_p) {
2241+
cb_arg = *cb_arg_p;
2242+
if (cb_arg->ch == ch) {
2243+
return &cb_arg->postfields;
22442244
}
2245-
mfp = zend_llist_get_prev(&ch->to_free->stream);
2245+
cb_arg_p = zend_llist_get_prev(&ch->to_free->stream);
22462246
}
22472247
return NULL;
22482248
}
@@ -2297,51 +2297,51 @@ PHP_FUNCTION(curl_copy_handle)
22972297
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
22982298
static size_t read_cb(char *buffer, size_t size, size_t nitems, void *arg) /* {{{ */
22992299
{
2300-
struct mime_file *mime_file = (struct mime_file *) arg;
2300+
struct mime_data_cb_arg *cb_arg = (struct mime_data_cb_arg *) arg;
23012301
ssize_t numread;
23022302

2303-
ZEND_ASSERT(!mime_file->ch);
2303+
ZEND_ASSERT(!cb_arg->ch);
23042304

2305-
if (mime_file->stream == NULL) {
2306-
if (!(mime_file->stream = php_stream_open_wrapper(ZSTR_VAL(mime_file->name), "rb", IGNORE_PATH, NULL))) {
2305+
if (cb_arg->stream == NULL) {
2306+
if (!(cb_arg->stream = php_stream_open_wrapper(ZSTR_VAL(cb_arg->filename), "rb", IGNORE_PATH, NULL))) {
23072307
return CURL_READFUNC_ABORT;
23082308
}
23092309
}
2310-
numread = php_stream_read(mime_file->stream, buffer, nitems * size);
2310+
numread = php_stream_read(cb_arg->stream, buffer, nitems * size);
23112311
if (numread < 0) {
2312-
php_stream_close(mime_file->stream);
2313-
mime_file->stream = NULL;
2312+
php_stream_close(cb_arg->stream);
2313+
cb_arg->stream = NULL;
23142314
}
23152315
return (numread >= 0) ? numread : CURL_READFUNC_ABORT;
23162316
}
23172317
/* }}} */
23182318

23192319
static int seek_cb(void *arg, curl_off_t offset, int origin) /* {{{ */
23202320
{
2321-
struct mime_file *mime_file = (struct mime_file *) arg;
2321+
struct mime_data_cb_arg *cb_arg = (struct mime_data_cb_arg *) arg;
23222322
int res;
23232323

2324-
ZEND_ASSERT(!mime_file->ch);
2324+
ZEND_ASSERT(!cb_arg->ch);
23252325

2326-
if (mime_file->stream == NULL) {
2327-
if (!(mime_file->stream = php_stream_open_wrapper(ZSTR_VAL(mime_file->name), "rb", IGNORE_PATH, NULL))) {
2326+
if (cb_arg->stream == NULL) {
2327+
if (!(cb_arg->stream = php_stream_open_wrapper(ZSTR_VAL(cb_arg->filename), "rb", IGNORE_PATH, NULL))) {
23282328
return CURL_SEEKFUNC_CANTSEEK;
23292329
}
23302330
}
2331-
res = php_stream_seek(mime_file->stream, offset, origin);
2331+
res = php_stream_seek(cb_arg->stream, offset, origin);
23322332
return !res ? CURL_SEEKFUNC_OK : CURL_SEEKFUNC_CANTSEEK;
23332333
}
23342334
/* }}} */
23352335

23362336
static void free_cb(void *arg) /* {{{ */
23372337
{
2338-
struct mime_file *mime_file = (struct mime_file *) arg;
2338+
struct mime_data_cb_arg *cb_arg = (struct mime_data_cb_arg *) arg;
23392339

2340-
ZEND_ASSERT(!mime_file->ch);
2340+
ZEND_ASSERT(!cb_arg->ch);
23412341

2342-
if (mime_file->stream != NULL) {
2343-
php_stream_close(mime_file->stream);
2344-
mime_file->stream = NULL;
2342+
if (cb_arg->stream != NULL) {
2343+
php_stream_close(cb_arg->stream);
2344+
cb_arg->stream = NULL;
23452345
}
23462346
}
23472347
/* }}} */
@@ -2985,7 +2985,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
29852985
zval *prop, rv;
29862986
char *type = NULL, *filename = NULL;
29872987
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
2988-
struct mime_file *mime_file;
2988+
struct mime_data_cb_arg *cb_arg;
29892989
#endif
29902990

29912991
prop = zend_read_property(curl_CURLFile_class, current, "name", sizeof("name")-1, 0, &rv);
@@ -3008,28 +3008,28 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
30083008
}
30093009

30103010
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
3011-
mime_file = emalloc(sizeof *mime_file);
3012-
mime_file->ch = ch;
3013-
ZVAL_COPY(&mime_file->postfields, zvalue);
3014-
zend_llist_add_element(&ch->to_free->stream, &mime_file);
3011+
cb_arg = emalloc(sizeof *cb_arg);
3012+
cb_arg->ch = ch;
3013+
ZVAL_COPY(&cb_arg->postfields, zvalue);
3014+
zend_llist_add_element(&ch->to_free->stream, &cb_arg);
30153015

3016-
mime_file = emalloc(sizeof *mime_file);
3017-
mime_file->ch = NULL;
3018-
mime_file->name = zend_string_copy(postval);
3019-
mime_file->stream = NULL;
3016+
cb_arg = emalloc(sizeof *cb_arg);
3017+
cb_arg->ch = NULL;
3018+
cb_arg->filename = zend_string_copy(postval);
3019+
cb_arg->stream = NULL;
30203020

30213021
part = curl_mime_addpart(mime);
30223022
if (part == NULL) {
30233023
zend_string_release_ex(string_key, 0);
30243024
return FAILURE;
30253025
}
30263026
if ((form_error = curl_mime_name(part, ZSTR_VAL(string_key))) != CURLE_OK
3027-
|| (form_error = curl_mime_data_cb(part, -1, read_cb, seek_cb, free_cb, mime_file)) != CURLE_OK
3027+
|| (form_error = curl_mime_data_cb(part, -1, read_cb, seek_cb, free_cb, cb_arg)) != CURLE_OK
30283028
|| (form_error = curl_mime_filename(part, filename ? filename : ZSTR_VAL(postval))) != CURLE_OK
30293029
|| (form_error = curl_mime_type(part, type ? type : "application/octet-stream")) != CURLE_OK) {
30303030
error = form_error;
30313031
}
3032-
zend_llist_add_element(&ch->to_free->stream, &mime_file);
3032+
zend_llist_add_element(&ch->to_free->stream, &cb_arg);
30333033
#else
30343034
form_error = curl_formadd(&first, &last,
30353035
CURLFORM_COPYNAME, ZSTR_VAL(string_key),

0 commit comments

Comments
 (0)