Hi Todd,

Todd C. Miller wrote on Fri, May 27, 2016 at 04:37:18PM -0600:

> Currently, mklocale only ignores the first blank after the VARIABLE
> definition.  This means that we store the variable definition along
> with the leading blanks.
> 
> The lexer should eat the blanks after VARIABLE before storing the
> variable definition.

Not quite sure what the benefit is - reducing the size of
/usr/share/locale/UTF-8/LC_CTYPE from 401093 to 401086 bytes?
Functionally, it doesn't matter, the only place in the code using
it, find_codeset() in libc/locale/rune.c, ignores leading garbage
anyway by using strstr(3).  Maybe you just consider it more
aestethically pleasing in the generated binary file?

But i don't see any downside either.  Given the above, it doesn't
break compatibility with other systems, and besides, even if it
would, that would hardly matter at this point, given that we are
using the program on exactly one file, during the build, and running
mklocale(1) doesn't really make sense on OpenBSD except during the
build for that one file.

So feel free if you want to.

Yours,
  Ingo


> Index: usr.bin/mklocale/lex.l
> ===================================================================
> RCS file: /cvs/src/usr.bin/mklocale/lex.l,v
> retrieving revision 1.3
> diff -u -p -u -r1.3 lex.l
> --- usr.bin/mklocale/lex.l    5 Dec 2012 23:20:25 -0000       1.3
> +++ usr.bin/mklocale/lex.l    27 May 2016 12:20:01 -0000
> @@ -114,7 +114,7 @@ SWIDTH1                           { yylval.i = 
> _RUNETYPE_SW1; r
>  SWIDTH2                              { yylval.i = _RUNETYPE_SW2; 
> return(LIST); }
>  SWIDTH3                              { yylval.i = _RUNETYPE_SW3; 
> return(LIST); }
>  
> -VARIABLE[\t ]                        { static char vbuf[1024];
> +VARIABLE[\t ]+                       { static char vbuf[1024];
>                                 char *v = vbuf;
>                                 while ((*v = input()) && *v != '\n')
>                                       ++v;

Reply via email to