From nobody Mon Nov 25 22:34:57 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=1594156447; cv=none; d=zohomail.com; s=zohoarc; b=AGau1Gd7n1HibLBvlkeHLj+gY4KBKmEhvwcQa5iP1mRGO2QtA6bfkMLhjx2aczpZeh+KtBKQQ6pald/T9QI8Kh4PMxKh53QXCbur04Bcx1j4jgZdl4mkjdneHOpHQgzOZFHYuWyOIicIEHqNY1XVl03aIbG6QzxVc7950NQ7yio= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594156447; h=Content-Type:Content-Transfer-Encoding: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=MHLbBvUyrxE+t0ibPIjbtBT8bMqrxucpD1T9ev/Pom4=; b=fqP6rS6j1F5lsaOfldDfsqp+ptAp4nWROO+orHoKpz1JAOTq63f7BvwshNiagY2Yc98H6YXX4CgN/erEYej2Ra4x4CJS8or19zsylAClcEa5VKpZ3o3vkfLtd4IBjYmSwC94tiFFaX6ctyEyye9VRfO0UBbg6nulGLtQ/zXKnkU= 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 1594156447142979.9913597971417; Tue, 7 Jul 2020 14:14:07 -0700 (PDT) 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-455-VAZ3-hr2NSq_q6xCr9AJ6Q-1; Tue, 07 Jul 2020 17:14:02 -0400 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 6A3FF1009613; Tue, 7 Jul 2020 21:13:56 +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 437681A921; Tue, 7 Jul 2020 21:13:56 +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 147671809557; Tue, 7 Jul 2020 21:13:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 067L8SnT008017 for ; Tue, 7 Jul 2020 17:08:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6E87A797E0; Tue, 7 Jul 2020 21:08:28 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-194.phx2.redhat.com [10.3.112.194]) by smtp.corp.redhat.com (Postfix) with ESMTP id 26C3E79220 for ; Tue, 7 Jul 2020 21:08:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594156445; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=MHLbBvUyrxE+t0ibPIjbtBT8bMqrxucpD1T9ev/Pom4=; b=IKGE9UsttvekPGdYMkm9Vie/UfV188bqo6xknl7/hlA1IZNY0DKhp3BSXeLCxd6KgFrHpP 5RH4m/faJRcHglsiSlQ4mmEHG51fOIHNACJ7yv74Juve/kQfz3fGfPAMWpSpwsaxogU3wz YEM88k4zSRhZHqAg1l77QrlJlydgJrU= X-MC-Unique: VAZ3-hr2NSq_q6xCr9AJ6Q-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v2 11/15] nwfilter: transform logic in virNWFilterRuleInstSort to eliminate label Date: Tue, 7 Jul 2020 17:08:11 -0400 Message-Id: <20200707210815.1797463-12-laine@redhat.com> In-Reply-To: <20200707210815.1797463-1-laine@redhat.com> References: <20200707210815.1797463-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This rewrite of a nested conditional produces the same results, but eliminate a goto and corresponding label. Signed-off-by: Laine Stump Reviewed-by: J=C3=A1n Tomko --- src/nwfilter/nwfilter_ebiptables_driver.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfil= ter_ebiptables_driver.c index cc0f3f93d9..94eaac927a 100644 --- a/src/nwfilter/nwfilter_ebiptables_driver.c +++ b/src/nwfilter/nwfilter_ebiptables_driver.c @@ -3113,13 +3113,12 @@ virNWFilterRuleInstSort(const void *a, const void *= b) /* ensure root chain commands appear before all others since we will need them to create the child chains */ if (root_a) { - if (root_b) - goto normal; - return -1; /* a before b */ - } - if (root_b) + if (!root_b) + return -1; /* a before b */ + } else if (root_b) { return 1; /* b before a */ - normal: + } + /* priorities are limited to range [-1000, 1000] */ return insta->priority - instb->priority; } --=20 2.25.4