From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas.monjalon@6wind.com>
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 <dev@dpdk.org>; Fri, 22 Jul 2016 18:16:30 +0200 (CEST)
Received: by mail-wm0-f43.google.com with SMTP id i5so73228748wmg.0
 for <dev@dpdk.org>; Fri, 22 Jul 2016 09:16:30 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=6wind-com.20150623.gappssmtp.com; s=20150623;
 h=from:to:cc:subject:date:message-id:user-agent:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=3htCEyfkVUUemKxYPqGV3vqkt4XmXrhtrqrfEpX98W4=;
 b=Ve1Hpcct8QbLFyQNVht5wdLyZgpeapnBcXf+Uhi1XJQpAvvl36tagyreSAUexBMDpG
 arzuG5iv2qZHQPClJb7ly1VxQUhl6K4Mi+IIkzszyfmnWymuETM0CTVtl7gJ8F2BrCyA
 FClFdRdDCHQNkjvydQ1QAqR0TJowdotIc0CyFsfzy0HZVPzE6Rc0EFatSujEAeINbaCS
 ZiuaKgaPUPzTLR2z2l9eIaorFT2pj8I3BIV2eFtR4GqmVJT/NkZnzU0JLv8VIEXB7nk3
 7rXGLR+krq5E0OVrEP8HJJDkBI8KFHYKFDmcRdJl5jcgI57v1wb3/wA9whjc0HstLrdd
 JFOg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent
 :in-reply-to:references:mime-version:content-transfer-encoding;
 bh=3htCEyfkVUUemKxYPqGV3vqkt4XmXrhtrqrfEpX98W4=;
 b=etug29wwkpxAWod6fpfJAjo2ZaDirSRrN7dqDuS22c7iuqBqdaEE42f/8T7WFyfNIh
 BlIiM3iav5eB79gdu5OveC9zkULwshBJnuAsmFeJwSypz8XT3AYrYxmRgc63thzlGtRy
 FmgIfpFhVd3vDaTlaomIwjNpDHhPqJGcXa9zpgRJl+ZTt2465yanqKdmREIK1l+pY/rO
 nnT5s5eCym0EeJpoVSURWsV5QLUTwF03ptTcC3RPvkC9xjETp5omCBvpdOz3Hgb/bArM
 /MqLqWu2ySOc10yG6XrWZ5ZDMug4/Kd3g5hbZ3mURbly5crcsYZq7gnT7zgPBjLR6yrj
 X0DA==
X-Gm-Message-State: AEkoousWpprGrwGlm3cwCmLRPhtkr6h632joBQh2LllQTsuAnwnX0fkJqSd6CkLcBO9paMa6
X-Received: by 10.194.133.104 with SMTP id pb8mr1688002wjb.139.1469204190328; 
 Fri, 22 Jul 2016 09:16:30 -0700 (PDT)
Received: from xps13.localnet (184.203.134.77.rev.sfr.net. [77.134.203.184])
 by smtp.gmail.com with ESMTPSA id n7sm1616600wjf.11.2016.07.22.09.16.29
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 22 Jul 2016 09:16:29 -0700 (PDT)
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Cc: dev@dpdk.org
Date: Fri, 22 Jul 2016 18:16:28 +0200
Message-ID: <3574578.EDiVgcMiqN@xps13>
User-Agent: KMail/4.14.10 (Linux/4.5.4-1-ARCH; KDE/4.14.11; x86_64; ; )
In-Reply-To: <1469203278-91363-1-git-send-email-sergio.gonzalez.monroy@intel.com>
References: <1469203278-91363-1-git-send-email-sergio.gonzalez.monroy@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Subject: Re: [dpdk-dev] [PATCH 1/2] eal: add stailq safe iterator macro
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 22 Jul 2016 16:16:30 -0000

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.