Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3610723pxk; Tue, 29 Sep 2020 01:13:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNubZ5wjczR0tD90oyPAHVHizRECqsOOOu+rx9gg/XRjpd1dbOVAZA12xQYy8ELDVYKibz X-Received: by 2002:aa7:c3c8:: with SMTP id l8mr2019622edr.368.1601367224174; Tue, 29 Sep 2020 01:13:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601367224; cv=none; d=google.com; s=arc-20160816; b=Qzbp3zDn8bo8TKgIebeEoGoTqBOApTaiWeww0sxtV91CclMRSojcoRKohd4mpHnxTf 6/2tnX21bF658LwomX2bx69ztvKmZShhemtGDUaRp2c6+3dWNuMnduDG+Z3CU6NisBhE kbuW7h8nqJNXWa2zVnNYGlbH3cLNnYEYKWPh0GsuHq2Djl7axlLJ6oJgmkhP0sse5EFA moVvjucTBfYPjGSTNXgz9gh8NJZvDNeAt2QhFWHdJbl60+7yrPwgU8n+U8/qS7jyUEch 1bJ/yvlxDvqLPrs7v12Mp16flu/xlG2KI6nx7RsBPpA4t+E/GWX0/YTLSvb5Ghz3Oz7A v1lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=w1Txq+QypW1k4pDaVlG6yd6cbfEy3gSjB3VvMpBDo/Y=; b=A1Z3BxrKbGNIAyaXwO53ehTRZdWqLCL6kIKvuSk6afCuqLz1BzgO8kXbOHETKwSp7E JhMH9Ei4OEJYdliJ/bhBWslG8PfT2mH3VYRm3CEMoVyHGeYd7KG9Rjsy932BuZ2d7RSg ZV1cqaG8gEYYbMReRrYTefuAtX0XyJ+QveNgQrind6WeHVieyvHi7NqlfBKaRvNWMIWh new8fU0KXllteOZQaSRxGh2EpTpwQ65juwX4JqMHqhT+EdxO24D4+Gb6yGy7gMClMO3O 2ySvJhKbosbL/G4bptc7tfcqhCVN5uR77NDzwrvISZo2sZ/EviBiwMqgRKb0zaw1Jz/8 w02w== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z9si2448999edp.477.2020.09.29.01.13.21; Tue, 29 Sep 2020 01:13:44 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727634AbgI2IKP convert rfc822-to-8bit (ORCPT + 99 others); Tue, 29 Sep 2020 04:10:15 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]:35803 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725826AbgI2IKP (ORCPT ); Tue, 29 Sep 2020 04:10:15 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-15-klZI1fUZOxCa-iii21fDrA-1; Tue, 29 Sep 2020 09:10:11 +0100 X-MC-Unique: klZI1fUZOxCa-iii21fDrA-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Tue, 29 Sep 2020 09:10:10 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Tue, 29 Sep 2020 09:10:10 +0100 From: David Laight To: 'Joe Perches' , Bartosz Golaszewski CC: Linus Walleij , Jonathan Corbet , Andy Shevchenko , "Kent Gibson" , "open list:GPIO SUBSYSTEM" , linux-doc , "Linux Kernel Mailing List" , Bartosz Golaszewski Subject: RE: [PATCH v2 1/9] lib: string_helpers: provide kfree_strarray() Thread-Topic: [PATCH v2 1/9] lib: string_helpers: provide kfree_strarray() Thread-Index: AQHWlbFc11/cqHtmU0iaxGR+buHrQql/RFkg Date: Tue, 29 Sep 2020 08:10:10 +0000 Message-ID: <3ba6779e11684ec8bc32638aa67ab952@AcuMS.aculab.com> References: <20200928104155.7385-1-brgl@bgdev.pl> <20200928104155.7385-2-brgl@bgdev.pl> <2fcfd81f62ec87d9b75cca32468d8b9583faec47.camel@perches.com> <12317bbc7712d96be8f52a3bf574e47628830191.camel@perches.com> In-Reply-To: <12317bbc7712d96be8f52a3bf574e47628830191.camel@perches.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)