public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Joe Perches <joe@perches.com>,
	George Spelvin <linux@sciencehorizons.net>
Cc: akpm@linux-foundation.org, bbjorn@mork.no,
	linux-kernel@vger.kernel.org, tytso@mit.edu
Subject: Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays
Date: Wed, 01 Jun 2016 15:32:47 +0300	[thread overview]
Message-ID: <1464784367.1767.8.camel@linux.intel.com> (raw)
In-Reply-To: <1464730604.14627.66.camel@perches.com>

On Tue, 2016-05-31 at 14:36 -0700, Joe Perches wrote:
> 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.

That function follows existing UUID API. Since we have now it
consolidated in one place someone may fix it eventually.

Refer to this discussion as well:
http://www.spinics.net/lists/linux-efi/msg08105.html

> 
> Linus once wrote: (http://comments.gmane.org/gmane.linux.kernel/203140
> 0)
> 
>     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)
> 

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

  parent reply	other threads:[~2016-06-01 12:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1464594339.27624.45.camel@linux.intel.com>
2016-05-30 17:32 ` [PATCH] lib/vsprintf.c: Further simplify uuid_string() George Spelvin
2016-05-31 20:31   ` [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays George Spelvin
2016-05-31 21:36     ` Joe Perches
2016-05-31 22:05       ` George Spelvin
2016-06-01 12:32       ` Andy Shevchenko [this message]
2016-06-01 15:07         ` George Spelvin
2016-06-02 16:48           ` Joe Perches
2016-06-01 19:58     ` Andrew Morton
2016-06-01 20:13       ` Andy Shevchenko
2016-06-03 11:17     ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464784367.1767.8.camel@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=bbjorn@mork.no \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@sciencehorizons.net \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox