quark

quark web server
git clone git://git.suckless.org/quark
Log | Files | Refs | LICENSE

commit 0b1c60eea22feb173ab507bc18eb599b2d6c4e40
parent 3a7c6ec0b9d06d37b9f7d3321eb0f95340505bc6
Author: Laslo Hunhold <dev@frign.de>
Date:   Fri,  4 Aug 2017 17:53:43 +0200

Rename _i,_argused to i_,argused_

Thanks Michael Forney for reporting this! We cannot use identifiers
beginning with an underscore, says the C99-standard, section 7.1.3:

"All identifiers that begin with an underscore are always reserved for
use as identifiers with file scope in both the ordinary and tag name
spaces."

We go around this by putting the underscore at the end.

Diffstat:
arg.h | 16++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arg.h b/arg.h @@ -23,15 +23,15 @@ extern char *argv0; /* int main(int argc, char *argv[]) */ #define ARGBEGIN for (argv0 = *argv, *argv ? (argc--, argv++) : ((void *)0); \ *argv && (*argv)[0] == '-' && (*argv)[1]; argc--, argv++) { \ - int _i, _argused; \ + int i_, argused_; \ if ((*argv)[1] == '-' && !(*argv)[2]) { \ argc--, argv++; \ break; \ } \ - for (_i = 1, _argused = 0; (*argv)[_i]; _i++) { \ - switch((*argv)[_i]) -#define ARGEND if (_argused) { \ - if ((*argv)[_i + 1]) { \ + for (i_ = 1, argused_ = 0; (*argv)[i_]; i_++) { \ + switch((*argv)[i_]) +#define ARGEND if (argused_) { \ + if ((*argv)[i_ + 1]) { \ break; \ } else { \ argc--, argv++; \ @@ -40,9 +40,9 @@ extern char *argv0; } \ } \ } -#define ARGC() ((*argv)[_i]) -#define ARGF_(x) (((*argv)[_i + 1]) ? (_argused = 1, &((*argv)[_i + 1])) : \ - (*(argv + 1)) ? (_argused = 1, *(argv + 1)) : (x)) +#define ARGC() ((*argv)[i_]) +#define ARGF_(x) (((*argv)[i_ + 1]) ? (argused_ = 1, &((*argv)[i_ + 1])) : \ + (*(argv + 1)) ? (argused_ = 1, *(argv + 1)) : (x)) #define EARGF(x) ARGF_(((x), exit(1), (char *)0)) #define ARGF() ARGF_((char *)0)