Inline dload_payload->curlerr field into a local variable
dload_payload->curlerr is a field that is used inside curl_download_internal() function only. It can be converted to a local variable. Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
dc98d0ea09
commit
fa68c33fa8
2 changed files with 5 additions and 5 deletions
|
@ -366,6 +366,7 @@ static int curl_download_internal(struct dload_payload *payload,
|
||||||
long timecond, remote_time = -1;
|
long timecond, remote_time = -1;
|
||||||
double remote_size, bytes_dl;
|
double remote_size, bytes_dl;
|
||||||
struct sigaction orig_sig_pipe, orig_sig_int;
|
struct sigaction orig_sig_pipe, orig_sig_int;
|
||||||
|
CURLcode curlerr;
|
||||||
/* shortcut to our handle within the payload */
|
/* shortcut to our handle within the payload */
|
||||||
alpm_handle_t *handle = payload->handle;
|
alpm_handle_t *handle = payload->handle;
|
||||||
CURL *curl = curl_easy_init();
|
CURL *curl = curl_easy_init();
|
||||||
|
@ -436,9 +437,9 @@ static int curl_download_internal(struct dload_payload *payload,
|
||||||
mask_signal(SIGINT, &inthandler, &orig_sig_int);
|
mask_signal(SIGINT, &inthandler, &orig_sig_int);
|
||||||
|
|
||||||
/* perform transfer */
|
/* perform transfer */
|
||||||
payload->curlerr = curl_easy_perform(curl);
|
curlerr = curl_easy_perform(curl);
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "curl returned error %d from transfer\n",
|
_alpm_log(handle, ALPM_LOG_DEBUG, "curl returned error %d from transfer\n",
|
||||||
payload->curlerr);
|
curlerr);
|
||||||
|
|
||||||
/* disconnect relationships from the curl handle for things that might go out
|
/* disconnect relationships from the curl handle for things that might go out
|
||||||
* of scope, but could still be touched on connection teardown. This really
|
* of scope, but could still be touched on connection teardown. This really
|
||||||
|
@ -447,7 +448,7 @@ static int curl_download_internal(struct dload_payload *payload,
|
||||||
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, (char *)NULL);
|
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, (char *)NULL);
|
||||||
|
|
||||||
/* was it a success? */
|
/* was it a success? */
|
||||||
switch(payload->curlerr) {
|
switch(curlerr) {
|
||||||
case CURLE_OK:
|
case CURLE_OK:
|
||||||
/* get http/ftp response code */
|
/* get http/ftp response code */
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "response code: %ld\n", payload->respcode);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "response code: %ld\n", payload->respcode);
|
||||||
|
@ -468,7 +469,7 @@ static int curl_download_internal(struct dload_payload *payload,
|
||||||
case CURLE_ABORTED_BY_CALLBACK:
|
case CURLE_ABORTED_BY_CALLBACK:
|
||||||
/* handle the interrupt accordingly */
|
/* handle the interrupt accordingly */
|
||||||
if(dload_interrupted == ABORT_OVER_MAXFILESIZE) {
|
if(dload_interrupted == ABORT_OVER_MAXFILESIZE) {
|
||||||
payload->curlerr = CURLE_FILESIZE_EXCEEDED;
|
curlerr = CURLE_FILESIZE_EXCEEDED;
|
||||||
payload->unlink_on_fail = 1;
|
payload->unlink_on_fail = 1;
|
||||||
handle->pm_errno = ALPM_ERR_LIBCURL;
|
handle->pm_errno = ALPM_ERR_LIBCURL;
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR,
|
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||||
|
|
|
@ -45,7 +45,6 @@ struct dload_payload {
|
||||||
int cb_initialized;
|
int cb_initialized;
|
||||||
#ifdef HAVE_LIBCURL
|
#ifdef HAVE_LIBCURL
|
||||||
CURL *curl;
|
CURL *curl;
|
||||||
CURLcode curlerr; /* last error produced by curl */
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue