[vlc-devel] [PATCH 1/2] actions: Fix MAXACTION value

Rémi Denis-Courmont remi at remlab.net
Thu Dec 10 18:11:42 CET 2020


Le jeudi 10 décembre 2020, 18:41:29 EET Romain Vimont a écrit :
> On Thu, Dec 10, 2020 at 05:15:26PM +0100, Hugo Beauzée-Luyssen wrote:
> > The longuest string is 26 characters long, not including terminal null
> > byte
> > ---
> > 
> >  src/misc/actions.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/src/misc/actions.c b/src/misc/actions.c
> > index b10b07936e..ddbf04ad65 100644
> > --- a/src/misc/actions.c
> > +++ b/src/misc/actions.c
> > 
> > @@ -255,7 +255,7 @@ found:
> >  /*** VLC key map ***/
> > 
> > -#define MAXACTION 26
> > +#define MAXACTION 27
> > 
> >  static const struct name2action
> >  {
> >  
> >      char psz[MAXACTION];
> 
> Is there a reason not to use:
> 
>     const char *psz;

Yes. We've already discussed this.

> instead of counting the number of characters (and losing space)?

Since a pointer will have an overhead of 8 bytes for itself and 24 bytes for 
its relocation, your approach is both slower and takes *more* space. And it'll 
make the data nonshareable.

-- 
Rémi Denis-Courmont




More information about the vlc-devel mailing list