lkml.org 
[lkml]   [2009]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [patch 3/3] flex_array: declare parts member to have incomplete type
From
Date
On Mon, 2009-08-17 at 16:46 -0700, David Rientjes wrote:
> The `parts' member of struct flex_array should evaluate to an incomplete
> type so that sizeof() cannot be used and C99 does not require the
> zero-length specification.
>
> Cc: Dave Hansen <dave@linux.vnet.ibm.com>
> Signed-off-by: David Rientjes <rientjes@google.com>
> ---
> include/linux/flex_array.h | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/include/linux/flex_array.h b/include/linux/flex_array.h
> --- a/include/linux/flex_array.h
> +++ b/include/linux/flex_array.h
> @@ -21,7 +21,7 @@ struct flex_array {
> struct {
> int element_size;
> int total_nr_elements;
> - struct flex_array_part *parts[0];
> + struct flex_array_part *parts[];
> };
> /*
> * This little trick makes sure that

That's a good little trick. I don't see any downside to it.

Signed-off-by: Dave Hansen <dave@linux.vnet.ibm.com>

-- Dave



\
 
 \ /
  Last update: 2009-08-18 02:09    [W:0.049 / U:0.852 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site