diff options
author | jmallett <jmallett@FreeBSD.org> | 2002-04-20 01:49:10 +0000 |
---|---|---|
committer | jmallett <jmallett@FreeBSD.org> | 2002-04-20 01:49:10 +0000 |
commit | ecccdb870361f2e0e62aea65bc8fa21a5171ea06 (patch) | |
tree | 9d6147d43f9f794cfc750ecb3f50fb216c889a70 /usr.bin/m4/extern.h | |
parent | 2e75617aafa86c07bed18ac6c9afca1d637e0523 (diff) | |
download | FreeBSD-src-ecccdb870361f2e0e62aea65bc8fa21a5171ea06.zip FreeBSD-src-ecccdb870361f2e0e62aea65bc8fa21a5171ea06.tar.gz |
Crank WARNS.
Cast sizeof() to (int), as it's being compared against an int, not a size_t.
If i is changed to a size_t, it means the logic must be slightly changed later
in the flow, where --i is checked to be >= 0. I am not sure I want to make a
logic change to account for clearing up a warning, when an aesthetic one will
keep from modifying the logic.
Other harmless casts, that I think I've made in the right directions.
Make gpbc() an inline function, rather than an obfuscated macro, make its
scratch space local, rather than global. The previous macro used a dirty
hack (logical AND in place of a conditional) which would lead GCC to throw
a fit (rightly so) as the logical check, as well as the incrementation of
a variable, were not used for anything.
const'ify a few places where gcc3 yells. xstrdup() some global consts in
places where we xstrdup() when not using consts, but tried to assign them
to non-consts before.
Don't use execv(2) if we don't have the kind of arguments it wants.
Reviewed by: asmodai obrien tjr
Submitted by: tjr (a gcc3 build log)
Diffstat (limited to 'usr.bin/m4/extern.h')
-rw-r--r-- | usr.bin/m4/extern.h | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/usr.bin/m4/extern.h b/usr.bin/m4/extern.h index 79c3a29..57a0600 100644 --- a/usr.bin/m4/extern.h +++ b/usr.bin/m4/extern.h @@ -71,7 +71,7 @@ extern void remhash(const char *, int); /* main.c */ extern void outputstr(const char *); extern int builtin_type(const char *); -extern char *builtin_realname(int); +extern const char *builtin_realname(int); extern void emitline(void); /* misc.c */ @@ -148,11 +148,27 @@ extern char *bbase[]; /* buffer base per ilevel */ extern char ecommt[MAXCCHARS+1];/* end character for comment */ extern char *ep; /* first free char in strspace */ extern char lquote[MAXCCHARS+1];/* left quote character (`) */ -extern char *m4wraps; /* m4wrap string default. */ -extern char *null; /* as it says.. just a null. */ +extern const char *m4wraps; /* m4wrap string default. */ +extern const char *null; /* as it says.. just a null. */ extern char rquote[MAXCCHARS+1];/* right quote character (') */ extern char scommt[MAXCCHARS+1];/* start character for comment */ extern int synccpp; /* Line synchronisation for C preprocessor */ -extern int chscratch; /* Scratch space for gpbc() macro */ extern int mimic_gnu; /* behaves like gnu-m4 */ + +/* get a possibly pushed-back-character, increment lineno if need be */ +static __inline int gpbc(void) +{ + int chscratch; /* Scratch space. */ + + if (bp > bufbase) { + if (*--bp) + return (*bp); + else + return (EOF); + } + chscratch = obtain_char(infile+ilevel); + if (chscratch == '\n') + ++inlineno[ilevel]; + return (chscratch); +} |