From patchwork Mon Jun 18 20:42:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 10472657 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9D5C96020C for ; Mon, 18 Jun 2018 20:42:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F6A028B73 for ; Mon, 18 Jun 2018 20:42:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 840A228BBE; Mon, 18 Jun 2018 20:42:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3637E28B73 for ; Mon, 18 Jun 2018 20:42:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936948AbeFRUmq (ORCPT ); Mon, 18 Jun 2018 16:42:46 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33427 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936286AbeFRUmo (ORCPT ); Mon, 18 Jun 2018 16:42:44 -0400 Received: by mail-wm0-f68.google.com with SMTP id z6-v6so16391965wma.0 for ; Mon, 18 Jun 2018 13:42:44 -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:in-reply-to:references; bh=8hGMo2EJk1xY6ez1M4NuguOZ+TwZjiuioeOP2PrsN/Q=; b=G5XhyylHsELyrOi9mjbiDBeMnngI7UoA8ukVxgStzg0v8F/dOHJGL81wGMU+TWNWxO A9MJzC67fFfgtKZGyUpG6EuPI8twqMYOm2iP7bs5WiiQSdl4oAEFr38npikpOi8Uv4UP iR7e2SQKtgstFUGN+I3A2kz7EH2iK1I7LFfcnpmG7UusqPiC+5LQ/aCAh9aTUv7Rcj0M NBgHzc/kUSTNgTwXS5cbykDBvZ+ULqqp0Q4288fAAJvP4eyNXtKhQbxrfJOL+24/IP8D el2PXgiKsFxVaKOiLEsnKv1n+MYcEl9Yg2ty4A6aafLnmb74xnAgakZ3YtIjWaHYzU55 PBRw== 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:in-reply-to :references; bh=8hGMo2EJk1xY6ez1M4NuguOZ+TwZjiuioeOP2PrsN/Q=; b=UAAxfeqycn/7tinnx4HrB0abe92xs1tZMSlEedcwHX1I7fPnwkPp3Ove/e3WLorAhj avqKoiBksiti8NUH1taWBlNVS8C6xEzQtj5E5aAV29jaFSeBFS6GZUz/6m0gJ5IcqbJJ abDqEOJL23qkzuqLlp4lu0k0S7WOGcbaGIEbkWspMWq2YDbb4ouZaA1nDt8zf1/JRI70 aP2+6s6VmKWvklrATGxFs8iO0Ocb9OeXc9QQy4Oot07C6d3YH2YgNDeYUOaptmdX5+SP Ahg9C2dehrZ+2785SypYDbZ+PyEOyVibiVHyq7KF7GBxj7IlOoR0RrrhfqQCyZ5DbI9+ lV+A== X-Gm-Message-State: APt69E2XKTu7A0LYgE6vPZcftMMlwiHH+WC5PaTj49IRavugr7SN2nOs JCMHfdzCEfLPWmYMgIyZhaKZMmpW X-Google-Smtp-Source: ADUXVKKfQCZOGysXZjSXTYzkgvlfRzPGrx14GXt1fHuBrLKWw/2aFDiQTOrZd5hNKD49yvYs0q5cVw== X-Received: by 2002:a50:a5ec:: with SMTP id b41-v6mr12285744edc.147.1529354563173; Mon, 18 Jun 2018 13:42:43 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:419e:1700:1d86:8bc0:bbb1:c152]) by smtp.gmail.com with ESMTPSA id d16-v6sm9475118ede.21.2018.06.18.13.42.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jun 2018 13:42:42 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 2/5] ptrlist: keep declaration of head-list-nr together Date: Mon, 18 Jun 2018 22:42:30 +0200 Message-Id: <20180618204233.68858-3-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180618204233.68858-1-luc.vanoostenryck@gmail.com> References: <20180618204233.68858-1-luc.vanoostenryck@gmail.com> Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The list walking macros need to keep some state: - the head of the list: head - the current list 'block': list - the current position in the block: nr Make this clear by keeping their declaration together. Signed-off-by: Luc Van Oostenryck --- ptrlist.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ptrlist.h b/ptrlist.h index 37d866de2..20a156427 100644 --- a/ptrlist.h +++ b/ptrlist.h @@ -124,9 +124,10 @@ extern void __free_ptr_list(struct ptr_list **); #define DO_FOR_EACH(head, ptr, __head, __list, __nr, PTR_ENTRY) do { \ __typeof__(head) __head = (head); \ __typeof__(head) __list = __head; \ + int __nr; \ if (!__head) \ break; \ - do { int __nr; \ + do { \ for (__nr = 0; __nr < __list->nr; __nr++) { \ ptr = PTR_ENTRY(__list,__nr); \ if (__list->rm && !ptr) \ @@ -140,9 +141,10 @@ extern void __free_ptr_list(struct ptr_list **); #define DO_FOR_EACH_REVERSE(head, ptr, __head, __list, __nr, PTR_ENTRY) do { \ __typeof__(head) __head = (head); \ __typeof__(head) __list = __head; \ + int __nr; \ if (!head) \ break; \ - do { int __nr; \ + do { \ __list = __list->prev; \ __nr = __list->nr; \ while (--__nr >= 0) { \