From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from was59-1-82-226-113-214.fbx.proxad.net ([82.226.113.214] helo=[192.168.0.10]) by mail.droids-corp.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1bEtn7-0007so-7e; Mon, 20 Jun 2016 09:38:41 +0200 To: Lazaros Koromilas References: <1466074939-29863-1-git-send-email-l@nofutznetworks.com> <1466074939-29863-4-git-send-email-l@nofutznetworks.com> <5763D2D5.3010209@6wind.com> Cc: dev@dpdk.org, Konstantin Ananyev , David Hunt From: Olivier Matz Message-ID: <57679CEC.3060909@6wind.com> Date: Mon, 20 Jun 2016 09:36:12 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v3 3/3] mempool: allow for user-owned mempool caches X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 07:36:20 -0000 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