From patchwork Mon Mar 9 22:36:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatol Pomozov X-Patchwork-Id: 1556 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id 9552617864A88 for ; Mon, 9 Mar 2020 22:37:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_ADSP_CUSTOM_MED=0.001, DKIM_INVALID=1,DKIM_SIGNED=0.1,FREEMAIL_FROM=0.5,MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3,SPF_HELO_NONE=0.001,T_DMARC_POLICY_NONE=0.01, T_DMARC_SIMPLE_DKIM=0.01 autolearn=ham autolearn_force=no version=3.4.4 X-Spam-BL-Results: [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Mon, 9 Mar 2020 22:37:06 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 6E62C19E181CA0; Mon, 9 Mar 2020 22:37:02 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [IPv6:2a01:4f8:160:3033::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: luna) by orion.archlinux.org (Postfix) with ESMTPSA id 3BC4A19E181C9B; Mon, 9 Mar 2020 22:37:02 +0000 (UTC) Authentication-Results: orion.archlinux.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VQd0akUD Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 2B5552A8F2; Mon, 9 Mar 2020 22:37:02 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VQd0akUD Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 0F4862A8F2 for ; Mon, 9 Mar 2020 22:36:59 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by luna.archlinux.org (Postfix) with ESMTPS for ; Mon, 9 Mar 2020 22:36:59 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 3BB1D19E181C99 for ; Mon, 9 Mar 2020 22:36:53 +0000 (UTC) Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS for ; Mon, 9 Mar 2020 22:36:53 +0000 (UTC) Received: by mail-pf1-x442.google.com with SMTP id l184so5494899pfl.7 for ; Mon, 09 Mar 2020 15:36:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cOjLI8z3iQG1+F5hNL1daKseOdx6N60yyIS+xo8DPIc=; b=VQd0akUDzMCfamagtT+O6bsG/iOZbDyRwZ2vgh7Z42bGHL9+/q14Yv4IJG6ftNQi9V iH5WdxSsF9HpV7x7kg1ukboS8rl5u/J6Zq0xCNH9vaE6si1rTfnihsaLrRyfIMZIlmxS pnnnsLTSCKR79xCmvr1zoeoZ/7zHurwjgflvobInulgWdH/b3BstoZrpdKAJZrNMAGCh wo4Sr5mV4eBwCdjcmL2JpfLJIazSjeZQz2AnO6WCB0oJ10RjqrcINoOQxQkDn7xkY9aD Lve17EcEK81tgu0+FmECiRO1OwgqiI3e5cECIZHZqTHILIKLBM7ZQSAgHB1YgUopclza qkGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cOjLI8z3iQG1+F5hNL1daKseOdx6N60yyIS+xo8DPIc=; b=n3nMZ+xS1loIUtFJpAbA6dgL1vsPcdSZR5/5vJ/Wy9cB1pT1LNnuGEL68ObAtY992I lPu2cUKLEFajZd669dWYsNAUyQECxAjFzrRxYNEWc/wHoWEUVTuecLBQcA23MmExIAGx bKjJ6VORFZBVjBmwT08VxaAwW8EvUKmYre1nHzxbSndvNs3KlX30r0fmV6jtQXA1n+ni 2ssz32BbzpXEYcg9IlERETcjAkpiXwqgZ9yxVM2D8gO51YvinPwFBJ58CD6bpAgPm5f7 PWQVgHlLlbvhvqFA0kuW+n3yn7r0x5F2GMLeeERFFbQB6x8WACuuoBmWkUyl0iBNkudO fAYg== X-Gm-Message-State: ANhLgQ03Jwb5QfZF5fQ5YKBdcxdjfF/3RUIVMju4e1CcjoW8g88N0jpC w+9Q0aQJD3OX8Z+o+pZd2lvX5l2srNw= X-Google-Smtp-Source: ADFU+vvua5RqkodUAjAhiRH+tdF8T31kmjGHlOAJyEsO1unTovK3CU/EqNLse4eCrq9QQhjAx6Fl0Q== X-Received: by 2002:aa7:96c5:: with SMTP id h5mr18178832pfq.242.1583793410931; Mon, 09 Mar 2020 15:36:50 -0700 (PDT) Received: from wolf.hsd1.ca.comcast.net ([2601:646:8500:a860:2efd:a1ff:febf:a363]) by smtp.gmail.com with ESMTPSA id q20sm3094864pfh.89.2020.03.09.15.36.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2020 15:36:50 -0700 (PDT) From: Anatol Pomozov To: pacman-dev@archlinux.org Date: Mon, 9 Mar 2020 15:36:48 -0700 Message-Id: <20200309223648.231458-1-anatol.pomozov@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [pacman-dev] [PATCH] Inline dload_payload->curlerr field into a local variable X-BeenThere: pacman-dev@archlinux.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for pacman development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Discussion list for pacman development Errors-To: pacman-dev-bounces@archlinux.org Sender: "pacman-dev" 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 --- lib/libalpm/dload.c | 9 +++++---- lib/libalpm/dload.h | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index 1f28c7c2..3570e234 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -366,6 +366,7 @@ static int curl_download_internal(struct dload_payload *payload, long timecond, remote_time = -1; double remote_size, bytes_dl; struct sigaction orig_sig_pipe, orig_sig_int; + CURLcode curlerr; /* shortcut to our handle within the payload */ alpm_handle_t *handle = payload->handle; CURL *curl = curl_easy_init(); @@ -437,9 +438,9 @@ static int curl_download_internal(struct dload_payload *payload, mask_signal(SIGINT, &inthandler, &orig_sig_int); /* 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", - payload->curlerr); + curlerr); /* disconnect relationships from the curl handle for things that might go out * of scope, but could still be touched on connection teardown. This really @@ -448,7 +449,7 @@ static int curl_download_internal(struct dload_payload *payload, curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, (char *)NULL); /* was it a success? */ - switch(payload->curlerr) { + switch(curlerr) { case CURLE_OK: /* get http/ftp response code */ _alpm_log(handle, ALPM_LOG_DEBUG, "response code: %ld\n", payload->respcode); @@ -469,7 +470,7 @@ static int curl_download_internal(struct dload_payload *payload, case CURLE_ABORTED_BY_CALLBACK: /* handle the interrupt accordingly */ if(dload_interrupted == ABORT_OVER_MAXFILESIZE) { - payload->curlerr = CURLE_FILESIZE_EXCEEDED; + curlerr = CURLE_FILESIZE_EXCEEDED; payload->unlink_on_fail = 1; handle->pm_errno = ALPM_ERR_LIBCURL; _alpm_log(handle, ALPM_LOG_ERROR, diff --git a/lib/libalpm/dload.h b/lib/libalpm/dload.h index 65fcdadb..e87b6a93 100644 --- a/lib/libalpm/dload.h +++ b/lib/libalpm/dload.h @@ -45,7 +45,6 @@ struct dload_payload { int cb_initialized; #ifdef HAVE_LIBCURL CURL *curl; - CURLcode curlerr; /* last error produced by curl */ #endif };