From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier Matz Subject: Re: [PATCH v3 3/3] mempool: allow for user-owned mempool caches Date: Mon, 20 Jun 2016 09:36:12 +0200 Message-ID: <57679CEC.3060909@6wind.com> References: <1466074939-29863-1-git-send-email-l@nofutznetworks.com> <1466074939-29863-4-git-send-email-l@nofutznetworks.com> <5763D2D5.3010209@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org, Konstantin Ananyev , David Hunt To: Lazaros Koromilas Return-path: Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id 454AC803D for ; Mon, 20 Jun 2016 09:36:20 +0200 (CEST) In-Reply-To: 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" Hi, On 06/18/2016 06:15 PM, Lazaros Koromilas wrote: >> What do you think of having: >> >> #define LOG_ERR() do { \ >> printf("test failed at %s():%d\n", __func__, __LINE__); \ >> } while (0) >> #define RET_ERR() do { LOG_ERR(); return -1; } while (0) >> #define GOTO_ERR() do { LOG_ERR(); ret = -1; goto out; } while (0) >> >> Then use GOTO_ERR() when appropriate. It would also factorize >> the printf. > > The downside of GOTO_ERR() is that it assumes a variable and a label > name. And you may need to have multiple labels 'out0', 'out1', etc for > the error path. How about: > > #define GOTO_ERR(ret, out) do { LOG_ERR(); ret = -1; goto out; } while (0) Yep, looks better indeed. Thanks, Olivier