From nobody Sat May 4 18:54:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577973514; cv=none; d=zohomail.com; s=zohoarc; b=bRo1FJvrLGYoLfL++bHAN6j1XKESwn5sJ0Us2BW8wyNGjyrhsVKvbQ4PAKuq/OOYFolPemLEy6yd2jul4QDvCQfplW0zOyeuxjmUgoHMlXnBUGB5TH5GUuiBqxobV/ybptaU6Cn5OsKLqANyuNFhsdu40Kt/IeixhsPKQ2Rz+Vs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577973514; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QCM/4rrXX728ukSRH99nG2LwicBlFAOUz+MHFalEd2I=; b=JbjTLOe2OAM17xYbfKk/xWONK9hLhxES6a+17OmceXrXsrCTX3tz5uH0Sy02queqZon79ELgLQYHXYL+lNcATC18ZQjI58cjF+tPd9WJ69MA8Qztjy/0MmoLF1TpXfxcJvB6PA0S4SSjFkn60c4cUgcTYRW3TfUBmvcg72hggGo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1577973514370275.1231238367709; Thu, 2 Jan 2020 05:58:34 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-146-LChnMlMPNOKFZ4v9rdeikg-1; Thu, 02 Jan 2020 08:58:30 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D0D5818A8C85; Thu, 2 Jan 2020 13:58:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AF563271B7; Thu, 2 Jan 2020 13:58:23 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6E54981E2E; Thu, 2 Jan 2020 13:58:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 002Dw78Z002265 for ; Thu, 2 Jan 2020 08:58:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id A12027A057; Thu, 2 Jan 2020 13:58:07 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01C657039B; Thu, 2 Jan 2020 13:58:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577973513; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=QCM/4rrXX728ukSRH99nG2LwicBlFAOUz+MHFalEd2I=; b=UR+PHHfFpWyh/Ls18eQ6l/4gl3czaE7BCYa0eGuS2UQWhPkRE4oURrqXoF5D+/x99bRhGj TxS6beugWdt1JUyi4fSnWVIAX+afmfkX7WlZrUNrhB+5iUOFTE1uFcvwwoSc93ucN/w6xY OWOYRx7CQpe9JjCuA4kxrsxzTAi2LXI= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Thu, 2 Jan 2020 14:57:52 +0100 Message-Id: <20200102135758.848454-2-fidencio@redhat.com> In-Reply-To: <20200102135758.848454-1-fidencio@redhat.com> References: <20200102135758.848454-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH 1/7] util: Rename 'no_memory' label to 'cleanup' X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: LChnMlMPNOKFZ4v9rdeikg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Let's rename the no_memory label to cleanup as the first step to remove the OOM handling in virfirewall.c file. Signed-off-by: Fabiano Fid=C3=AAncio --- src/util/virfirewall.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c index ee72b579e4..c6a5de8842 100644 --- a/src/util/virfirewall.c +++ b/src/util/virfirewall.c @@ -321,7 +321,7 @@ void virFirewallFree(virFirewallPtr firewall) if (VIR_RESIZE_N(rule->args, \ rule->argsAlloc, \ rule->argsLen, 1) < 0) \ - goto no_memory; \ + goto cleanup; \ \ rule->args[rule->argsLen++] =3D g_strdup(str); \ } while (0) @@ -348,7 +348,7 @@ virFirewallAddRuleFullV(virFirewallPtr firewall, =20 =20 if (VIR_ALLOC(rule) < 0) - goto no_memory; + goto cleanup; =20 rule->layer =3D layer; rule->queryCB =3D cb; @@ -379,18 +379,18 @@ virFirewallAddRuleFullV(virFirewallPtr firewall, if (VIR_APPEND_ELEMENT_COPY(group->rollback, group->nrollback, rule) < 0) - goto no_memory; + goto cleanup; } else { if (VIR_APPEND_ELEMENT_COPY(group->action, group->naction, rule) < 0) - goto no_memory; + goto cleanup; } =20 =20 return rule; =20 - no_memory: + cleanup: firewall->err =3D ENOMEM; virFirewallRuleFree(rule); return NULL; @@ -494,7 +494,7 @@ void virFirewallRuleAddArg(virFirewallPtr firewall, =20 return; =20 - no_memory: + cleanup: firewall->err =3D ENOMEM; } =20 @@ -516,7 +516,7 @@ void virFirewallRuleAddArgFormat(virFirewallPtr firewal= l, =20 return; =20 - no_memory: + cleanup: firewall->err =3D ENOMEM; } =20 @@ -534,7 +534,7 @@ void virFirewallRuleAddArgSet(virFirewallPtr firewall, =20 return; =20 - no_memory: + cleanup: firewall->err =3D ENOMEM; } =20 @@ -557,7 +557,7 @@ void virFirewallRuleAddArgList(virFirewallPtr firewall, =20 return; =20 - no_memory: + cleanup: firewall->err =3D ENOMEM; va_end(list); } --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 18:54:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577973549; cv=none; d=zohomail.com; s=zohoarc; b=Nu8R8AtETGxc2sDbp26h8fEyIWqBk3G506MycwgHV8vyd2E6YDfLZavqglohEyWTlnG3gkoH4gkjnKDZ3ova5xpjDD/hEDGJn4TFRcLsOhqIREyZWhHSjSLMRFDjIoFtThFae/E+4NwCDSggkJwZha+KxT8jIEFEtT2x9eOXW/0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577973549; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6xZYLkCFcfoP/Pn9QmjaVKcdEz6UBG5Wego3GiTKskc=; b=Sl84DptutCY276pHC3pfSb6QF4qrVt75GhhOTrapVYuCkUYHUr2P2RJ7bbq5XdyqEWjpkLqvV4+vPdGqbPl4dVmfh0mUXwMuu5UogNQuy4/aObA7GpI5AQywUfkFCZ6OIWK4THIYMbZDvrj2DUPXFpNmNwKKH/XXQEOvqzjPt94= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 15779735490821007.8303767665238; Thu, 2 Jan 2020 05:59:09 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-377-a4tAndC7NxG2T5jJfB5AHQ-1; Thu, 02 Jan 2020 08:58:33 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 88026DB87; Thu, 2 Jan 2020 13:58:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 63301271B4; Thu, 2 Jan 2020 13:58:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2399081E30; Thu, 2 Jan 2020 13:58:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 002Dw8V6002278 for ; Thu, 2 Jan 2020 08:58:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9D48E7A057; Thu, 2 Jan 2020 13:58:08 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE7647039B; Thu, 2 Jan 2020 13:58:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577973548; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=6xZYLkCFcfoP/Pn9QmjaVKcdEz6UBG5Wego3GiTKskc=; b=K4vmpnCBucWfLsVmAmkg3pDXlVuiZsxgdQp/6pCq+iqcUlZtVzp8G3UYQH8jpHbzjkR735 odcs72TCa8xnYipwfp1rHOOtoBYn71FMeCE8RgkJdEqFIQ/Lh4UGDIN9R+cOwsabI+4kEh zA4KM9dVsDhO3Sb2tBKEy1Cb0kpi9bU= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Thu, 2 Jan 2020 14:57:53 +0100 Message-Id: <20200102135758.848454-3-fidencio@redhat.com> In-Reply-To: <20200102135758.848454-1-fidencio@redhat.com> References: <20200102135758.848454-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH 2/7] util: Don't set/check for ENOMEM as a firewall error X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: a4tAndC7NxG2T5jJfB5AHQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) As libvirt decided to take the path to not report OOM and simply abort when it happens, let's get rid of OOM treatment in virfirewall.c and simplify the code whenever it's possible. Signed-off-by: Fabiano Fid=C3=AAncio --- src/util/virfirewall.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c index c6a5de8842..00b1bd0a97 100644 --- a/src/util/virfirewall.c +++ b/src/util/virfirewall.c @@ -391,7 +391,6 @@ virFirewallAddRuleFullV(virFirewallPtr firewall, return rule; =20 cleanup: - firewall->err =3D ENOMEM; virFirewallRuleFree(rule); return NULL; } @@ -492,10 +491,8 @@ void virFirewallRuleAddArg(virFirewallPtr firewall, =20 ADD_ARG(rule, arg); =20 - return; - cleanup: - firewall->err =3D ENOMEM; + return; } =20 =20 @@ -514,10 +511,8 @@ void virFirewallRuleAddArgFormat(virFirewallPtr firewa= ll, =20 ADD_ARG(rule, arg); =20 - return; - cleanup: - firewall->err =3D ENOMEM; + return; } =20 =20 @@ -532,10 +527,8 @@ void virFirewallRuleAddArgSet(virFirewallPtr firewall, args++; } =20 - return; - cleanup: - firewall->err =3D ENOMEM; + return; } =20 =20 @@ -553,12 +546,7 @@ void virFirewallRuleAddArgList(virFirewallPtr firewall, while ((str =3D va_arg(list, char *)) !=3D NULL) ADD_ARG(rule, str); =20 - va_end(list); - - return; - cleanup: - firewall->err =3D ENOMEM; va_end(list); } =20 @@ -591,15 +579,13 @@ void virFirewallStartTransaction(virFirewallPtr firew= all, =20 VIR_FIREWALL_RETURN_IF_ERROR(firewall); =20 - if (!(group =3D virFirewallGroupNew())) { - firewall->err =3D ENOMEM; + if (!(group =3D virFirewallGroupNew())) return; - } + group->actionFlags =3D flags; =20 if (VIR_EXPAND_N(firewall->groups, firewall->ngroups, 1) < 0) { - firewall->err =3D ENOMEM; virFirewallGroupFree(group); return; } @@ -747,10 +733,6 @@ virFirewallApplyRule(virFirewallPtr firewall, if (rule->queryCB(firewall, rule->layer, (const char *const *)line= s, rule->queryOpaque) < 0) return -1; =20 - if (firewall->err =3D=3D ENOMEM) { - virReportOOMError(); - return -1; - } if (firewall->err) { virReportSystemError(firewall->err, "%s", _("Unable to create rule")); @@ -818,7 +800,7 @@ virFirewallApply(virFirewallPtr firewall) _("Failed to initialize a valid firewall backend")); goto cleanup; } - if (!firewall || firewall->err =3D=3D ENOMEM) { + if (!firewall) { virReportOOMError(); goto cleanup; } --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 18:54:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577973501; cv=none; d=zohomail.com; s=zohoarc; b=NOCv7Apgv0W3sV9Ng8ywexz92uuE67T8goB3mBEIUNFzLLtpWncqebTUzMaMOTLH6U4kkJ+IGC+0LUcpjNZYF3nbBk0MzbZLaV4JenQcKDoC/FoPneXzKsCu/7YXDjaNMq4ycixsqBVH8KnLGKu4HUB919f2PDZd2juMxxYUWOM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577973501; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=q93pU4oqjC5Zmh1jtA7CRB/CZFuCUNgYWo2/wPAJ62Y=; b=SUsmMACcvZzV0GLbXS6vNURNgOAh8Ai0WeJpYuKiJPdClfo9X5kWUuICWGFlQeQ2Z7dNh1u7O+9Hk8XyLbVvPekgvM1WMAXika5hQbdUwWYkjKtwL43MxEbGmlkbKlmAvqSnylweHzLQ2OHaF/e1IgQBoEHSES5BObmmw0eK8Cc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1577973501515610.6868652666755; Thu, 2 Jan 2020 05:58:21 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-4-a9_HAWGYPDaYyi5CkgeSsg-1; Thu, 02 Jan 2020 08:58:17 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 063B3801E7E; Thu, 2 Jan 2020 13:58:12 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9B54060C87; Thu, 2 Jan 2020 13:58:11 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A311081E07; Thu, 2 Jan 2020 13:58:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 002Dw9Zt002292 for ; Thu, 2 Jan 2020 08:58:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id 96B517A057; Thu, 2 Jan 2020 13:58:09 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA03B7039B; Thu, 2 Jan 2020 13:58:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577973500; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=q93pU4oqjC5Zmh1jtA7CRB/CZFuCUNgYWo2/wPAJ62Y=; b=JrgX0lTn5Qd/uVTPTyK+MzfV/MCEE/aT4f0Pd/9HyNxAcLVNxoxBLRyATTaXRO18H4ZBMw CY9UHpcAp52iuqdS/l4JFIeVYaq6nb6bupejaPhwDd+bXfoSyM0+QLBQXRvahrIoFg0qgq Y1P4vHOfOfha2Us4szQb0DzpW8KB+rY= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Thu, 2 Jan 2020 14:57:54 +0100 Message-Id: <20200102135758.848454-4-fidencio@redhat.com> In-Reply-To: <20200102135758.848454-1-fidencio@redhat.com> References: <20200102135758.848454-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH 3/7] util: Use g_auto/g_autofree in virFirewallAddRuleFullV() X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: a9_HAWGYPDaYyi5CkgeSsg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Fabiano Fid=C3=AAncio --- src/util/virfirewall.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c index 00b1bd0a97..d6fff31318 100644 --- a/src/util/virfirewall.c +++ b/src/util/virfirewall.c @@ -257,6 +257,7 @@ virFirewallRuleFree(virFirewallRulePtr rule) VIR_FREE(rule); } =20 +G_DEFINE_AUTO_CLEANUP_FREE_FUNC(virFirewallRulePtr, virFirewallRuleFree, N= ULL); =20 static void virFirewallGroupFree(virFirewallGroupPtr group) @@ -335,8 +336,8 @@ virFirewallAddRuleFullV(virFirewallPtr firewall, va_list args) { virFirewallGroupPtr group; - virFirewallRulePtr rule; - char *str; + g_auto(virFirewallRulePtr) rule =3D NULL; + g_autofree char *str =3D NULL; =20 VIR_FIREWALL_RETURN_NULL_IF_ERROR(firewall); =20 @@ -348,7 +349,7 @@ virFirewallAddRuleFullV(virFirewallPtr firewall, =20 =20 if (VIR_ALLOC(rule) < 0) - goto cleanup; + return NULL; =20 rule->layer =3D layer; rule->queryCB =3D cb; @@ -379,19 +380,18 @@ virFirewallAddRuleFullV(virFirewallPtr firewall, if (VIR_APPEND_ELEMENT_COPY(group->rollback, group->nrollback, rule) < 0) - goto cleanup; + return NULL; } else { if (VIR_APPEND_ELEMENT_COPY(group->action, group->naction, rule) < 0) - goto cleanup; + return NULL; } =20 =20 - return rule; + return g_steal_pointer(&rule); =20 cleanup: - virFirewallRuleFree(rule); return NULL; } =20 --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 18:54:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577973547; cv=none; d=zohomail.com; s=zohoarc; b=JGueRxoZLJSvGa1Y6JThdi4gFA5b4NrpRSKsQbiIMpnxDM5w2IgCqesCODn1XkqGZ2GMpILREG2wzIMWNkEFuuwscELg9b2Cq9jdY3/MazoL6yAc1z1fMiWYDD+cX5UCB1Bt9Ne9mA31+0iUVzmpRZJFlh1b4pBQ2zvTZbdzxlg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577973547; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YrBamX8RwjxBIRrZbAgD9oGmfe9R8b1sFuEyR/jihxo=; b=ljJApLDXQRBFMAFEjDLjFKGyRsRK8711FywYBYT6df/L4EULegt1FGKoPGnjfJDrrDzcbVRTKmXL6TvfeChEPrGIXlzPvnDPWr4OWxfPx0UBbpli2sM3SsH+BdkWcOlnMOlDKWr4shpmkJqR4ksgpvbA5/VI0QMq/gy+Q03s7Qs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1577973547017171.92116345234695; Thu, 2 Jan 2020 05:59:07 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-285-XIUt7ljhO1CQ9JJLzbNU_g-1; Thu, 02 Jan 2020 08:58:38 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 42DD4800594; Thu, 2 Jan 2020 13:58:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1BC2619C5B; Thu, 2 Jan 2020 13:58:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CC4C618089D0; Thu, 2 Jan 2020 13:58:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 002DwAsG002303 for ; Thu, 2 Jan 2020 08:58:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8EA187A057; Thu, 2 Jan 2020 13:58:10 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id E33597039B; Thu, 2 Jan 2020 13:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577973542; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=YrBamX8RwjxBIRrZbAgD9oGmfe9R8b1sFuEyR/jihxo=; b=dB14OjXhGUK94ORrTGdB3ON1BIGjxHG2w8Kt1fKaOWt5zVWF+D4i9TEuCYj6OA8diH1AMY SMA5rXAz13OPhTcDXh/ipzE2XQ3UbL7qMQ/lLVkVcDvTS7NkKR2EbidLtsl4uYb7m5vSRC HZcngmQh+4kIM068CzmCSNzuLoTBPuU= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Thu, 2 Jan 2020 14:57:55 +0100 Message-Id: <20200102135758.848454-5-fidencio@redhat.com> In-Reply-To: <20200102135758.848454-1-fidencio@redhat.com> References: <20200102135758.848454-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH 4/7] util: Use g_auto in virFirewallStartTransaction() X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: XIUt7ljhO1CQ9JJLzbNU_g-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Fabiano Fid=C3=AAncio --- src/util/virfirewall.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c index d6fff31318..6dace18bc4 100644 --- a/src/util/virfirewall.c +++ b/src/util/virfirewall.c @@ -278,6 +278,7 @@ virFirewallGroupFree(virFirewallGroupPtr group) VIR_FREE(group); } =20 +G_DEFINE_AUTO_CLEANUP_FREE_FUNC(virFirewallGroupPtr, virFirewallGroupFree,= NULL); =20 /** * virFirewallFree: @@ -575,7 +576,7 @@ size_t virFirewallRuleGetArgCount(virFirewallRulePtr ru= le) void virFirewallStartTransaction(virFirewallPtr firewall, unsigned int flags) { - virFirewallGroupPtr group; + g_auto(virFirewallGroupPtr) group =3D NULL; =20 VIR_FIREWALL_RETURN_IF_ERROR(firewall); =20 @@ -586,10 +587,9 @@ void virFirewallStartTransaction(virFirewallPtr firewa= ll, =20 if (VIR_EXPAND_N(firewall->groups, firewall->ngroups, 1) < 0) { - virFirewallGroupFree(group); return; } - firewall->groups[firewall->ngroups - 1] =3D group; + firewall->groups[firewall->ngroups - 1] =3D g_steal_pointer(&group); firewall->currentGroup =3D firewall->ngroups - 1; } =20 --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 18:54:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577973524; cv=none; d=zohomail.com; s=zohoarc; b=Y3I7FYlMu0dMn16w4BIR9k32+9a+Ffl1V/y5ZC6gZX+zjfC7WkGMI9MZ+vWNPYUoP8D//tcz+OoU4VbUW/b5XZCA7QO114PUQa5bq/HCiQsfhgbMWLbL4Kf/NIeTE0KHuIim3PVOVpiKCtCfqUQg6vl7Q0HeyS1yuuRETXUkLfk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577973524; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2KxulkCd75AINxGoZReM1xY2jZQ6j6H1vNsIWe14P3Q=; b=Y5nckcuDE0uJHCVxyysNHTDP25Ox+Mgn0WaqcNs7CuiPeVZUhF/zx40hw16YPBnwSwKL0FluZDsM3nY93EkTiDQxh4St/Qse1tmLUr7YCjXmC9s1uVN8ASzbTwJbSqDyPnvf5SAP0cIUwFrEXZeR6qkRnDWxPI3feq/yi+P2FAs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1577973524797342.9994513099249; Thu, 2 Jan 2020 05:58:44 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-265-qynfmLdvMMKjuccxZp-pig-1; Thu, 02 Jan 2020 08:58:42 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 687F9DB64; Thu, 2 Jan 2020 13:58:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 326CA5D9C9; Thu, 2 Jan 2020 13:58:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 81AAC81E2F; Thu, 2 Jan 2020 13:58:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 002DwBOY002312 for ; Thu, 2 Jan 2020 08:58:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8814B7A057; Thu, 2 Jan 2020 13:58:11 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB8AC7039B; Thu, 2 Jan 2020 13:58:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577973523; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=2KxulkCd75AINxGoZReM1xY2jZQ6j6H1vNsIWe14P3Q=; b=JsiSp55mthDBEmEptZcYjaSBbr2cyhcuaEyO5MRMXp6Z3P91IxidxYCnkzV4qAzrBkHEJq d/QPn28+NWDUbPd7QwPrr9wtsjZwaxJTETLV5TTWz3HlX+XQqXPXtbyseWINSIYWS5YuoL lSlYUiVgBLWgELQmiZoByVVpnexnLOc= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Thu, 2 Jan 2020 14:57:56 +0100 Message-Id: <20200102135758.848454-6-fidencio@redhat.com> In-Reply-To: <20200102135758.848454-1-fidencio@redhat.com> References: <20200102135758.848454-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH 5/7] util: Add ADD_ARG_RETURN_ON_ERROR X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: qynfmLdvMMKjuccxZp-pig-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Similarly to ADD_ARG, let's create an ADD_ARG_RETURN_ON_ERROR macro which will simply return instead of going to a cleanup label. By doing this, we can get rid of a few cleanup labels spread in the code. Signed-off-by: Fabiano Fid=C3=AAncio --- src/util/virfirewall.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c index 6dace18bc4..d632f72502 100644 --- a/src/util/virfirewall.c +++ b/src/util/virfirewall.c @@ -328,6 +328,16 @@ void virFirewallFree(virFirewallPtr firewall) rule->args[rule->argsLen++] =3D g_strdup(str); \ } while (0) =20 +#define ADD_ARG_RETURN_ON_ERROR(rule, str) \ + do { \ + if (VIR_RESIZE_N(rule->args, \ + rule->argsAlloc, \ + rule->argsLen, 1) < 0) \ + return; \ + \ + rule->args[rule->argsLen++] =3D g_strdup(str); \ + } while (0) + static virFirewallRulePtr virFirewallAddRuleFullV(virFirewallPtr firewall, virFirewallLayer layer, @@ -490,10 +500,7 @@ void virFirewallRuleAddArg(virFirewallPtr firewall, { VIR_FIREWALL_RULE_RETURN_IF_ERROR(firewall, rule); =20 - ADD_ARG(rule, arg); - - cleanup: - return; + ADD_ARG_RETURN_ON_ERROR(rule, arg); } =20 =20 @@ -510,10 +517,7 @@ void virFirewallRuleAddArgFormat(virFirewallPtr firewa= ll, arg =3D g_strdup_vprintf(fmt, list); va_end(list); =20 - ADD_ARG(rule, arg); - - cleanup: - return; + ADD_ARG_RETURN_ON_ERROR(rule, arg); } =20 =20 @@ -524,12 +528,9 @@ void virFirewallRuleAddArgSet(virFirewallPtr firewall, VIR_FIREWALL_RULE_RETURN_IF_ERROR(firewall, rule); =20 while (*args) { - ADD_ARG(rule, *args); + ADD_ARG_RETURN_ON_ERROR(rule, *args); args++; } - - cleanup: - return; } =20 =20 --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 18:54:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577973503; cv=none; d=zohomail.com; s=zohoarc; b=faCzx1WGafCQvlkC9KDL9KtZwOCW6EK5vE6GTEHBtU2tVUy9NvurpYB3KL3Pg3y9IbFXBB375wEx3qugcpCkMPUQnrNl+QlBVtGIG7HBQ0bC4mm7+7opzTSC0VRH6Qs2bifgcnpybJKcFFSSvair+HKHvypzLxyfFRhB9+KB7zs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577973503; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gN+qsNo7NgWK7NlQn0psCMkYwoiuVc50smgc3m/ZLAc=; b=lqymt/G+1RU2hcB014XneJvxctfEwVwmPPl3Py/tWWJEHLYOcCoFnmgdCHkOB+6Vq5tjStEwlfhkjaOq7WBjIum6OB0Gvb0617a8U4vpjIFQGrCA+afss5MiicFfMyAxh3cURmtFChqUYj4oDWnyrEEakTtxKX1tIDVRGF4G38U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1577973503067881.9797948515704; Thu, 2 Jan 2020 05:58:23 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-220-6GxBWzl1PWqec7Jnhw1VLw-1; Thu, 02 Jan 2020 08:58:20 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D439A100551A; Thu, 2 Jan 2020 13:58:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A7A4984649; Thu, 2 Jan 2020 13:58:14 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 695C318089CF; Thu, 2 Jan 2020 13:58:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 002DwC5T002322 for ; Thu, 2 Jan 2020 08:58:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id 823557A057; Thu, 2 Jan 2020 13:58:12 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id D62F07039B; Thu, 2 Jan 2020 13:58:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577973501; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=gN+qsNo7NgWK7NlQn0psCMkYwoiuVc50smgc3m/ZLAc=; b=a0HmESikCPxHtXNs5Ox0kiwUmGMcW0RVCu+Q4P/ShTYjl9fPsJTF3LjLjGUH+kEuYQ08+R Iym18J4AWqMwx60VtkBnMZgZ9llkvyMQ4u+ImJEv6jr9ibXeVqxCQWk66w/yiCX24bJjQT 7lXLgJzl1Rt4LcVZdSRBuHEW2jTkkao= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Thu, 2 Jan 2020 14:57:57 +0100 Message-Id: <20200102135758.848454-7-fidencio@redhat.com> In-Reply-To: <20200102135758.848454-1-fidencio@redhat.com> References: <20200102135758.848454-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH 6/7] util: Add ADD_ARG_RETURN_VALUE_ON_ERROR X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: 6GxBWzl1PWqec7Jnhw1VLw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Similarly to ADD_ARG, let's create an ADD_ARG_RETURN_VALUE_ON_ERROR macro which will simply return a value instead of going to a cleanup label. This patch will get rid of the cleanup label present in virFirewallAddRuleFullV(). Signed-off-by: Fabiano Fid=C3=AAncio --- src/util/virfirewall.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c index d632f72502..1b04fc5ee4 100644 --- a/src/util/virfirewall.c +++ b/src/util/virfirewall.c @@ -338,6 +338,16 @@ void virFirewallFree(virFirewallPtr firewall) rule->args[rule->argsLen++] =3D g_strdup(str); \ } while (0) =20 +#define ADD_ARG_RETURN_VALUE_ON_ERROR(rule, str, value) \ + do { \ + if (VIR_RESIZE_N(rule->args, \ + rule->argsAlloc, \ + rule->argsLen, 1) < 0) \ + return value; \ + \ + rule->args[rule->argsLen++] =3D g_strdup(str); \ + } while (0) + static virFirewallRulePtr virFirewallAddRuleFullV(virFirewallPtr firewall, virFirewallLayer layer, @@ -370,22 +380,22 @@ virFirewallAddRuleFullV(virFirewallPtr firewall, switch (rule->layer) { case VIR_FIREWALL_LAYER_ETHERNET: if (ebtablesUseLock) - ADD_ARG(rule, "--concurrent"); + ADD_ARG_RETURN_VALUE_ON_ERROR(rule, "--concurrent", NULL); break; case VIR_FIREWALL_LAYER_IPV4: if (iptablesUseLock) - ADD_ARG(rule, "-w"); + ADD_ARG_RETURN_VALUE_ON_ERROR(rule, "-w", NULL); break; case VIR_FIREWALL_LAYER_IPV6: if (ip6tablesUseLock) - ADD_ARG(rule, "-w"); + ADD_ARG_RETURN_VALUE_ON_ERROR(rule, "-w", NULL); break; case VIR_FIREWALL_LAYER_LAST: break; } =20 while ((str =3D va_arg(args, char *)) !=3D NULL) - ADD_ARG(rule, str); + ADD_ARG_RETURN_VALUE_ON_ERROR(rule, str, NULL); =20 if (group->addingRollback) { if (VIR_APPEND_ELEMENT_COPY(group->rollback, @@ -401,9 +411,6 @@ virFirewallAddRuleFullV(virFirewallPtr firewall, =20 =20 return g_steal_pointer(&rule); - - cleanup: - return NULL; } =20 =20 --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 18:54:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577973546; cv=none; d=zohomail.com; s=zohoarc; b=SZyuoT3fdgJi45WwACFM/nASWzZ9YdAam4FsEtoutV+PoMfOCrmyAuhWS5irZiuoEbUXlrsIOc0LbaeQWLzJqyRHI9gu5VVKUBnAm8xpr165dl15IDsOsA5Qu39kEVjXDpDePVjssi54dco7C6Wmb2s9Afl7oH99UgSk5zhJ6oc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577973546; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GzNrD4qejwSddz3ib/+Ky4AztcsClrVYLH2F9ZIyHqQ=; b=IjbOL5n3C5xQKdegYNeV8gjgn0ELRWfeuwUiAX40pGcNH6pNR4RJl71MDCl0RKhAPAdbGqMssPMlQyhUyXiR08CafRvu+CFVUI1Yt83G1IQ06BkzfZz2mxdr3/osldq9tNCr9O9RxsmtWZsEGGAQ2ZT/3+XISV1k2NKNU322pjU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1577973546936199.72032313405032; Thu, 2 Jan 2020 05:59:06 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-29-VtCFtU_8NjCXeUO4sLveaQ-1; Thu, 02 Jan 2020 08:58:34 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5BAA7800585; Thu, 2 Jan 2020 13:58:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3887A843FC; Thu, 2 Jan 2020 13:58:28 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EB1C318089D0; Thu, 2 Jan 2020 13:58:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 002DwDqP002332 for ; Thu, 2 Jan 2020 08:58:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7B0607A073; Thu, 2 Jan 2020 13:58:13 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id CFF0B7A061; Thu, 2 Jan 2020 13:58:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577973544; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=GzNrD4qejwSddz3ib/+Ky4AztcsClrVYLH2F9ZIyHqQ=; b=hlR741Mayu3TAZhMYLN35XLA+0Q8s1LDxp3mCnl9GI2hUtiQ8wvfOg3L43c24hVOxH9mI+ vWSgUYeYNYY4NvuQUF9klza9/ddsLW2mtTgY8bIHsXv+iRGifr70RdJP+XVQKMG9T7NrKQ 4hK5XvrO9TNNI2F2Qox8WByhqiiCqFo= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Thu, 2 Jan 2020 14:57:58 +0100 Message-Id: <20200102135758.848454-8-fidencio@redhat.com> In-Reply-To: <20200102135758.848454-1-fidencio@redhat.com> References: <20200102135758.848454-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH 7/7] docs: Remove mention to no_memory label X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: VtCFtU_8NjCXeUO4sLveaQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) no_memory labels have been entirely removed from libvirt codebase. Knowing that, let's also remove any mention to the label from our hacking guide. Signed-off-by: Fabiano Fid=C3=AAncio --- docs/hacking.html.in | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/hacking.html.in b/docs/hacking.html.in index 74aba5d46b..90bd0ddc81 100644 --- a/docs/hacking.html.in +++ b/docs/hacking.html.in @@ -1491,7 +1491,6 @@ BAD:
       error: A path only taken upon return with an error code
     cleanup: A path taken upon return with success code + optional error
-  no_memory: A path only taken upon return with an OOM error code
       retry: If needing to jump upwards (e.g., retry on EINTR)
 
=20 --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list