mirror of
https://github.com/curl/curl.git
synced 2026-07-23 12:07:17 +03:00
lib505: tidy up slist pointer use
Bring code closer to `curl_slist_append()` man page and clarify variable names. Closes #21835
This commit is contained in:
parent
2a63957204
commit
28341c303d
1 changed files with 13 additions and 14 deletions
|
|
@ -38,9 +38,8 @@ static CURLcode test_lib505(const char *URL)
|
|||
FILE *hd_src;
|
||||
int hd;
|
||||
curlx_struct_stat file_info;
|
||||
struct curl_slist *hl;
|
||||
|
||||
struct curl_slist *headerlist = NULL;
|
||||
struct curl_slist *headerlist;
|
||||
struct curl_slist *temp;
|
||||
|
||||
static const char *buf_1 = "RNFR 505";
|
||||
static const char *buf_2 = "RNTO 505-forreal";
|
||||
|
|
@ -92,24 +91,24 @@ static CURLcode test_lib505(const char *URL)
|
|||
|
||||
/* build a list of commands to pass to libcurl */
|
||||
|
||||
hl = curl_slist_append(headerlist, buf_1);
|
||||
if(!hl) {
|
||||
curl_mfprintf(stderr, "curl_slist_append() failed\n");
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
curlx_fclose(hd_src);
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
headerlist = curl_slist_append(hl, buf_2);
|
||||
headerlist = curl_slist_append(NULL, buf_1);
|
||||
if(!headerlist) {
|
||||
curl_mfprintf(stderr, "curl_slist_append() failed\n");
|
||||
curl_slist_free_all(hl);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
curlx_fclose(hd_src);
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
headerlist = hl;
|
||||
temp = curl_slist_append(headerlist, buf_2);
|
||||
if(!temp) {
|
||||
curl_mfprintf(stderr, "curl_slist_append() failed\n");
|
||||
curl_slist_free_all(headerlist);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
curlx_fclose(hd_src);
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
headerlist = temp;
|
||||
|
||||
/* enable uploading */
|
||||
test_setopt(curl, CURLOPT_UPLOAD, 1L);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue