From nobody Sun Feb 8 21:29:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1574274800; cv=none; d=zoho.com; s=zohoarc; b=H8ERb81KYndlBD838rXauUk1cllXkPa08ozzHdftkL7GCpIM28AwmRozBRB/UB6S6rnTm2VEFyaHiPxfOXGBtxLXpa+Jj7fYex26vVQYl1AOoQu+5JkDdRGpu3MACUCVd00fSM9TBMhZJalZywSoizbgJgzM5eNhah2d0pHSWTI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574274800; 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=whsl2KRNt1g8grAxtNWtxKEwRd9aVjF1pSRkCANbKX0=; b=ROgDEhH5vo279GjYrdUYtdt9ZbepBn/txCfa1qN+f0XYBB3slaF5zewBPOHPLp2daqAgC9j9M5y9aKiO/sBcvyq7ZYkYpi6V0kkn64j/Jf5dxYzd1eSTSGJ8eldE1vUi2xgJtIQC4uL6gg6F5h0xXgM6nnjaXSrN9kCHAe2fWEA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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 1574274800469340.32802150843906; Wed, 20 Nov 2019 10:33:20 -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-217-SC6wBTOwMaKn3JzmFU4VCg-1; Wed, 20 Nov 2019 13:33:16 -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 582E780268B; Wed, 20 Nov 2019 18:33:10 +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 297CD6BF98; Wed, 20 Nov 2019 18:33:10 +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 D5C7F4E566; Wed, 20 Nov 2019 18:33:09 +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 xAKIWrPL013462 for ; Wed, 20 Nov 2019 13:32:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 763E551B6C; Wed, 20 Nov 2019 18:32:53 +0000 (UTC) Received: from icr.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id EACB551B65 for ; Wed, 20 Nov 2019 18:32:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574274799; 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=whsl2KRNt1g8grAxtNWtxKEwRd9aVjF1pSRkCANbKX0=; b=Vg5gt0SsV2UOmn9FwrSJ2hzE5hMPzfM9tNGyOyTrMdjCKZccoktL/BD7OMwtoPAM4K8jyV +fiQoUbi9f0uPsBc+d9FTKERlbO91TFlBnNFunkrpsAqA9RkwFEFPBWSVHWiqC31TSeEc0 gKQ7rxbCWwLJx0TocXP22dqPSb9tK4o= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Wed, 20 Nov 2019 19:32:44 +0100 Message-Id: <9e14d339365355208549c6edee02a6d16ea6cf85.1574274649.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/3] scripts: speedup prohibit-duplicate-header 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: SC6wBTOwMaKn3JzmFU4VCg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Running regular expressions with capture groups is expensive. Bail out early if the line does not start with a '#'. This reduces the runtime of the check by two thirds. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Erik Skultety --- scripts/prohibit-duplicate-header.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/prohibit-duplicate-header.py b/scripts/prohibit-duplic= ate-header.py index dfdfa0bf0b..420311ccef 100644 --- a/scripts/prohibit-duplicate-header.py +++ b/scripts/prohibit-duplicate-header.py @@ -30,6 +30,10 @@ def check_file(filename): for line in fh: lineno =3D lineno + 1 =20 + # skip non-matching lines early + if line[0] !=3D '#': + continue + headermatch =3D re.search(r'''^# *include *[<"]([^>"]*\.h)[">]= ''', line) if headermatch is not None: inc =3D headermatch.group(1) --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list