Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3654061pxk; Tue, 29 Sep 2020 02:45:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx52tvcZl/Cn+VuvgE4Db/gHppBPDlMhE9at1ALeamwZUWmIQG3cq0Qyeq42CALKQ/Q3sfV X-Received: by 2002:a17:906:3e14:: with SMTP id k20mr706190eji.282.1601372700029; Tue, 29 Sep 2020 02:45:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601372700; cv=none; d=google.com; s=arc-20160816; b=0G9axQMTDM6MN+O1vhbB98Y3pcm71RWrlu1doJnbuzVGLEcF2gmRyGv2sAdgfnaHiV R5GUBxqK4kBUbAWDFYYKKpSZosw8YjVk+XVYNlfrET6HgF0vO507ruKeWkMBDeEPm21o dOUfWf7Rp8cmr9E2V5nbe0jWuDRd6/p7lnV8g1NCr6/Pi6VT5fYHHtvylTdAWLr5k4q7 zCzLfJlieFM4f+MJOJTVoK7/lm9b0o5hcvoWM1PTz5YLs1mxCSuu6fPtrVDNZW2KmYSu pzE59n3RYnJcbBFPQ5MNPzvQHNDjdD6HLtWWh7yVYoKMkguPjF7m5EsDWr67P3tYbwVa 61zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ofBo1DHZJAYOAfdvKdc+JIzoJ7spso5qBxDDaOUD8P0=; b=wp69YqAcK8j6x6G308oQZNlBUqzqo+eUtu/plhtHbDe+A9K377bCR0NI/0e/MjbRH4 48Fu4mnCk0pXSd4YaNXLX1R/mDHH4xl5WVKy1636MxF7ELWmA2JGmH0nNcP4lVd6tFeC xfE0oq5xJNV+sGTTHieDzb9MW7zSXgXmaL9fwjXcwQHBlyWo86eS7JW0gCIKEW5rnDCy CuTU7JTOQZI1a5K4Zts8U0Eq8x0TaGD8CtTYbW0d+5mqHmY8LfE6/zWfD2PN6JCOt8y8 tTpbARQ1pSZDbIwHOeNqX+ukvfFBzVyImSU5B3DJccLWp9QptdKoQryWt/Hx1IB+0go+ 4CMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=fTyuu6u3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y19si2593823edi.411.2020.09.29.02.44.36; Tue, 29 Sep 2020 02:45:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=fTyuu6u3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727894AbgI2Jm4 (ORCPT + 99 others); Tue, 29 Sep 2020 05:42:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727854AbgI2Jm4 (ORCPT ); Tue, 29 Sep 2020 05:42:56 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E1EFC0613D1 for ; Tue, 29 Sep 2020 02:42:56 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id k18so4076353wmj.5 for ; Tue, 29 Sep 2020 02:42:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ofBo1DHZJAYOAfdvKdc+JIzoJ7spso5qBxDDaOUD8P0=; b=fTyuu6u3qm+M2poqn0Gh7usMFQPyTseW+CABT/qMsrjz9vOA8ceeD4o7RmCWOO26dW oEaa7rL+447KXdmCLIYEt0xHiW6wdJTKY/qI1uMQxBs0Nd5zdu0trrBr1m0YFgNNt6rG 8oGSRaxE7XwJ8CME7sbQRGm4iczVVBYCbzkuAwleDfDszVa5s/EtrWW9nrBvClGfiQpM KjjsFT2izPU0BbVZrdZjX8npp+iXjBHsJ3db51ZC+kXY09b9YgK7ziZgel3ZOKf/ncTe QjmfoEa7fSN+S1tCyKDwsN/YF7tyGjJPBAUeuQltd45vLTSOPaqTGd74EXDsdziiCEDc /IfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ofBo1DHZJAYOAfdvKdc+JIzoJ7spso5qBxDDaOUD8P0=; b=KZULDgQIRBM9n51S6VSxNLKF0UZrmQclCHAvzGeg/+vOP4bbmDMl4R8mk+jfKXnY+G 82NS5xJIpRS05QM86TsBwCntYLusgERzcFJGprtyOHD39ODeTPgFlG6C7jFUKdGAPwwr zyH2qKSswoNxZqsyjsetiRbbO/5WW+dsCXbCgEMJHLLnDQG7RTdy+tkYU/3KaLFWZtxT om46eM8rSq+EhUrvE9DtNJyHQgIbVbeaRknvgbNceZPdsMihfrggBZvyNKhXH0wykUHE lntNerfEeAIJl65FI62vpGY/QK1CDsSt1S3c7gtwPpzLBvXSTDx+E+OKFwJ4JGzbF9nw PPoA== X-Gm-Message-State: AOAM5333Q2D/tVAhE78jqELhgLXF1zNMsb5Tl0WazJuaATTTflYDPmRV xmM86sMSzjEPNBIPsANo2nzdv+eFCUjDsmX4QChVw6UVqIk= X-Received: by 2002:a05:600c:22d1:: with SMTP id 17mr3540326wmg.58.1601372574620; Tue, 29 Sep 2020 02:42:54 -0700 (PDT) MIME-Version: 1.0 References: <20200928104155.7385-1-brgl@bgdev.pl> <20200928104155.7385-2-brgl@bgdev.pl> <2fcfd81f62ec87d9b75cca32468d8b9583faec47.camel@perches.com> <12317bbc7712d96be8f52a3bf574e47628830191.camel@perches.com> <3ba6779e11684ec8bc32638aa67ab952@AcuMS.aculab.com> <20200929084912.GZ3956970@smile.fi.intel.com> In-Reply-To: <20200929084912.GZ3956970@smile.fi.intel.com> From: Bartosz Golaszewski Date: Tue, 29 Sep 2020 11:42:43 +0200 Message-ID: Subject: Re: [PATCH v2 1/9] lib: string_helpers: provide kfree_strarray() To: Andy Shevchenko Cc: David Laight , Joe Perches , Bartosz Golaszewski , Linus Walleij , Jonathan Corbet , Kent Gibson , "open list:GPIO SUBSYSTEM" , linux-doc , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 29, 2020 at 10:49 AM Andy Shevchenko wrote: > > On Tue, Sep 29, 2020 at 08:10:10AM +0000, David Laight wrote: > > From: Joe Perches > > > Sent: 28 September 2020 17:07 > > > > > > On Mon, 2020-09-28 at 18:02 +0200, Bartosz Golaszewski wrote: > > > > On Mon, Sep 28, 2020 at 5:59 PM Joe Perches wrote: > > > > > On Mon, 2020-09-28 at 12:41 +0200, Bartosz Golaszewski wrote: > > > > > > From: Bartosz Golaszewski > > > > > > > > > > > > There's a common pattern of dynamically allocating an array of char > > > > > > pointers and then also dynamically allocating each string in this > > > > > > array. Provide a helper for freeing such a string array with one call. > > > > > > > > > > Isn't this also common for things like ring buffers? > > > > > Why limit this to char *[]? > > > > > > > > > > > > > I don't want to add APIs nobody is using. What do you suggest? > > > > > > Change the argument to void** and call it > > > > > > void kfree_array(void **array, int count); > > > > Does help, void doesn't work that way. > > Actually good catch. void * and void ** have a big difference in the implicit > casting behaviour. I was stumbled over this while playing with some > experimental stuff locally. > I'll keep kfree_strarray() then. Bart