From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH 1/2] eal: add stailq safe iterator macro Date: Fri, 22 Jul 2016 18:16:28 +0200 Message-ID: <3574578.EDiVgcMiqN@xps13> References: <1469203278-91363-1-git-send-email-sergio.gonzalez.monroy@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org To: Sergio Gonzalez Monroy Return-path: Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by dpdk.org (Postfix) with ESMTP id 877C05594 for ; Fri, 22 Jul 2016 18:16:30 +0200 (CEST) Received: by mail-wm0-f43.google.com with SMTP id i5so73228748wmg.0 for ; Fri, 22 Jul 2016 09:16:30 -0700 (PDT) In-Reply-To: <1469203278-91363-1-git-send-email-sergio.gonzalez.monroy@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2016-07-22 17:01, Sergio Gonzalez Monroy: > Removing/freeing elements elements within a STAILQ_FOREACH loop > is not safe. FreeBSD defines STAILQ_FOREACH_SAFE macro, which permits > these operations safely. > > This patch defines this macro for Linux systems, where it is not defined. [...] > +#ifndef SLIST_FOREACH_SAFE > +#define SLIST_FOREACH_SAFE(var, head, field, tvar) \ > + for ((var) = SLIST_FIRST((head)); \ > + (var) && ((tvar) = SLIST_NEXT((var), field), 1); \ > + (var) = (tvar)) > +#endif The patch 2 requires STAILQ_FOREACH_SAFE, not SLIST_FOREACH_SAFE.