lkml.org 
[lkml]   [2016]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] drm: move allocation out of drm_get_format_name()
On Saturday, 2016-11-05 13:11:36 +0100, Christian König wrote:
> Am 05.11.2016 um 02:33 schrieb Eric Engestrom:
> > +typedef char drm_format_name_buf[32];
>
> Please don't use a typedef for this, just define the maximum size of
> characters the function might write somewhere.
>
> See the kernel coding style as well:
> > In general, a pointer, or a struct that has elements that can reasonably
> > be directly accessed should **never** be a typedef.
>

I would normally agree as I tend to hate typedefs ($DAYJOB {ab,mis}uses
them way too much), and your way was what I wrote at first, but Rob Clark's
typedef idea makes it much harder for someone to allocate a buffer of
the wrong size, which IMO is good thing here.

I can rewrite the typedef out if you think it's better.

Cheers,
Eric

\
 
 \ /
  Last update: 2016-11-05 17:40    [W:0.086 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site