From: Joe Perches <joe@perches.com>
To: George Spelvin <linux@sciencehorizons.net>,
andriy.shevchenko@linux.intel.com
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: Tue, 31 May 2016 14:36:44 -0700 [thread overview]
Message-ID: <1464730604.14627.66.camel@perches.com> (raw)
In-Reply-To: <20160531203122.7243.qmail@ns.sciencehorizons.net>
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)
next prev parent reply other threads:[~2016-05-31 21:36 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 [this message]
2016-05-31 22:05 ` George Spelvin
2016-06-01 12:32 ` Andy Shevchenko
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=1464730604.14627.66.camel@perches.com \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bbjorn@mork.no \
--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;
as well as URLs for NNTP newsgroup(s).