From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756685AbcEaVgt (ORCPT ); Tue, 31 May 2016 17:36:49 -0400 Received: from smtprelay0173.hostedemail.com ([216.40.44.173]:50561 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752864AbcEaVgs (ORCPT ); Tue, 31 May 2016 17:36:48 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:41:355:379:541:599:967:973:988:989:1260:1263:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2525:2560:2563:2682:2685:2828:2859:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3352:3622:3770:3865:3866:3868:3870:3872:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:5007:7266:7904:8599:8603:9025:10004:10400:10848:11026:11232:11658:11783:11914:12043:12517:12519:12555:12740:13069:13311:13357:13439:13894:14181:14659:14721:21080:21434,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: fact10_5822fc55cdb52 X-Filterd-Recvd-Size: 1871 Message-ID: <1464730604.14627.66.camel@perches.com> Subject: Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays From: Joe Perches To: George Spelvin , andriy.shevchenko@linux.intel.com Cc: akpm@linux-foundation.org, bbjorn@mork.no, linux-kernel@vger.kernel.org, tytso@mit.edu Date: Tue, 31 May 2016 14:36:44 -0700 In-Reply-To: <20160531203122.7243.qmail@ns.sciencehorizons.net> References: <20160531203122.7243.qmail@ns.sciencehorizons.net> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.2-0ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2016-05-31 at 16:31 -0400, George Spelvin wrote: > Here's a patch implementing the suggestion I made earlier.  This reduces > code size, data size, and run time for input and output of UUIDs. [] > diff --git a/lib/uuid.c b/lib/uuid.c [] > @@ -97,32 +97,28 @@ bool uuid_is_valid(const char *uuid) >  } >  EXPORT_SYMBOL(uuid_is_valid); >   > -static int __uuid_to_bin(const char *uuid, __u8 b[16], const u8 ei[16]) > +static int __uuid_to_bin(const char uuid[36], __u8 b[16], const u8 si[16]) Functions with sized array arguments are generally undesired. Linus once wrote: (http://comments.gmane.org/gmane.linux.kernel/2031400) array arguments in C don't actually exist. Sadly, compilers accept it for various bad historical reasons, and silently turn it into just a pointer argument. There are arguments for them, but they are from weak minds. Perhaps this would be better using simple pointers and without the __ static int __uuid_to_bin(const char *uuid, u8 *b, const u8 *si)