sh: Cast -1 to pointer rather than pointer to variable of wrong type.

NEOF needs to be a non-null pointer distinct from valid union node pointers.
It is not dereferenced.

The new NEOF is much like SIG_ERR except that it is an object pointer
instead of a function pointer.

The variable tokpushback can now be static.
This commit is contained in:
Jilles Tjoelker 2013-08-30 10:45:02 +00:00
parent 5a280dbdd6
commit f52924b480
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=255068
2 changed files with 3 additions and 5 deletions

View File

@ -96,7 +96,7 @@ static struct heredoc *heredoclist; /* list of here documents to read */
static int doprompt; /* if set, prompt the user */ static int doprompt; /* if set, prompt the user */
static int needprompt; /* true if interactive and at start of line */ static int needprompt; /* true if interactive and at start of line */
static int lasttoken; /* last token read */ static int lasttoken; /* last token read */
int tokpushback; /* last token pushed back */ static int tokpushback; /* last token pushed back */
static char *wordtext; /* text of last word returned by readtoken */ static char *wordtext; /* text of last word returned by readtoken */
static int checkkwd; static int checkkwd;
static struct nodelist *backquotelist; static struct nodelist *backquotelist;

View File

@ -68,11 +68,9 @@
/* /*
* NEOF is returned by parsecmd when it encounters an end of file. It * NEOF is returned by parsecmd when it encounters an end of file. It
* must be distinct from NULL, so we use the address of a variable that * must be distinct from NULL.
* happens to be handy.
*/ */
extern int tokpushback; #define NEOF ((union node *)-1)
#define NEOF ((union node *)&tokpushback)
extern int whichprompt; /* 1 == PS1, 2 == PS2 */ extern int whichprompt; /* 1 == PS1, 2 == PS2 */
extern const char *const parsekwd[]; extern const char *const parsekwd[];