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.
This commit is contained in:
parent
3a7c6ec0b9
commit
0b1c60eea2
1 changed files with 8 additions and 8 deletions
16
arg.h
16
arg.h
|
@ -23,15 +23,15 @@ extern char *argv0;
|
||||||
/* int main(int argc, char *argv[]) */
|
/* int main(int argc, char *argv[]) */
|
||||||
#define ARGBEGIN for (argv0 = *argv, *argv ? (argc--, argv++) : ((void *)0); \
|
#define ARGBEGIN for (argv0 = *argv, *argv ? (argc--, argv++) : ((void *)0); \
|
||||||
*argv && (*argv)[0] == '-' && (*argv)[1]; argc--, argv++) { \
|
*argv && (*argv)[0] == '-' && (*argv)[1]; argc--, argv++) { \
|
||||||
int _i, _argused; \
|
int i_, argused_; \
|
||||||
if ((*argv)[1] == '-' && !(*argv)[2]) { \
|
if ((*argv)[1] == '-' && !(*argv)[2]) { \
|
||||||
argc--, argv++; \
|
argc--, argv++; \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
for (_i = 1, _argused = 0; (*argv)[_i]; _i++) { \
|
for (i_ = 1, argused_ = 0; (*argv)[i_]; i_++) { \
|
||||||
switch((*argv)[_i])
|
switch((*argv)[i_])
|
||||||
#define ARGEND if (_argused) { \
|
#define ARGEND if (argused_) { \
|
||||||
if ((*argv)[_i + 1]) { \
|
if ((*argv)[i_ + 1]) { \
|
||||||
break; \
|
break; \
|
||||||
} else { \
|
} else { \
|
||||||
argc--, argv++; \
|
argc--, argv++; \
|
||||||
|
@ -40,9 +40,9 @@ extern char *argv0;
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define ARGC() ((*argv)[_i])
|
#define ARGC() ((*argv)[i_])
|
||||||
#define ARGF_(x) (((*argv)[_i + 1]) ? (_argused = 1, &((*argv)[_i + 1])) : \
|
#define ARGF_(x) (((*argv)[i_ + 1]) ? (argused_ = 1, &((*argv)[i_ + 1])) : \
|
||||||
(*(argv + 1)) ? (_argused = 1, *(argv + 1)) : (x))
|
(*(argv + 1)) ? (argused_ = 1, *(argv + 1)) : (x))
|
||||||
#define EARGF(x) ARGF_(((x), exit(1), (char *)0))
|
#define EARGF(x) ARGF_(((x), exit(1), (char *)0))
|
||||||
#define ARGF() ARGF_((char *)0)
|
#define ARGF() ARGF_((char *)0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue