[hackers] [quark] Rename _i,_argused to i_,argused_ || Laslo Hunhold

From: <git_AT_suckless.org>
Date: Fri, 4 Aug 2017 17:58:38 +0200 (CEST)

commit 0b1c60eea22feb173ab507bc18eb599b2d6c4e40
Author: Laslo Hunhold <dev_AT_frign.de>
AuthorDate: Fri Aug 4 17:53:43 2017 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Fri Aug 4 17:57:58 2017 +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.

diff --git a/arg.h b/arg.h
index ac9a2fb..7f503ec 100644
--- a/arg.h
+++ b/arg.h
_AT_@ -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++; \
_AT_@ -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)
 
Received on Fri Aug 04 2017 - 17:58:38 CEST

This archive was generated by hypermail 2.3.0 : Fri Aug 04 2017 - 18:02:21 CEST