Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1410646

Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays
Date 2016-05-31 23:40 +0200
Message-ID <rEZyi-7VD-13@gated-at.bofh.it> (permalink)
References <rEYCd-7mM-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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)

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays "George Spelvin" <linux@sciencehorizons.net> - 2016-05-31 22:40 +0200
  Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays Joe Perches <joe@perches.com> - 2016-05-31 23:40 +0200
    Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays "George Spelvin" <linux@sciencehorizons.net> - 2016-06-01 00:10 +0200
    Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-06-01 14:40 +0200
      Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays "George Spelvin" <linux@sciencehorizons.net> - 2016-06-01 17:10 +0200
        Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays Joe Perches <joe@perches.com> - 2016-06-02 18:50 +0200
  Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays Andrew Morton <akpm@linux-foundation.org> - 2016-06-01 22:00 +0200
    Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-06-01 22:20 +0200
  Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-06-03 13:20 +0200

csiph-web