From patchwork Tue Sep 1 00:12:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 32697 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 55747B7B8E for ; Tue, 1 Sep 2009 10:18:41 +1000 (EST) Received: from localhost ([127.0.0.1]:54246 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MiH54-0003gt-Al for incoming@patchwork.ozlabs.org; Mon, 31 Aug 2009 20:18:38 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MiH1j-0002zX-Po for qemu-devel@nongnu.org; Mon, 31 Aug 2009 20:15:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MiH1f-0002yH-C3 for qemu-devel@nongnu.org; Mon, 31 Aug 2009 20:15:11 -0400 Received: from [199.232.76.173] (port=52341 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MiH1f-0002yE-3b for qemu-devel@nongnu.org; Mon, 31 Aug 2009 20:15:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15822) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MiH1e-0005if-MR for qemu-devel@nongnu.org; Mon, 31 Aug 2009 20:15:06 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n810F5sB025117; Mon, 31 Aug 2009 20:15:05 -0400 Received: from localhost.localdomain (vpn2-9-5.ams2.redhat.com [10.36.9.5]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n810F155016691; Mon, 31 Aug 2009 20:15:04 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Tue, 1 Sep 2009 02:12:32 +0200 Message-Id: <3357a6eaf07cbd8331bf6cc3609fffdcef24ed6a.1251763774.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: aliguori@us.ibm.com Subject: [Qemu-devel] [PATCH 2/3] Add LIST_FOREACH_SAFE() definition X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Juan Quintela --- sys-queue.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/sys-queue.h b/sys-queue.h index cb6a4c8..eb89a4d 100644 --- a/sys-queue.h +++ b/sys-queue.h @@ -126,6 +126,11 @@ struct { \ (var); \ (var) = ((var)->field.le_next)) +#define LIST_FOREACH_SAFE(var, head, field, next_var) \ + for ((var) = ((head)->lh_first); \ + (var) && ((next_var) = ((var)->field.le_next), 1); \ + (var) = (next_var)) + /* * List access methods. */