diff options
| author | dsl <dsl@NetBSD.org> | 2009-01-16 20:50:24 +0000 |
|---|---|---|
| committer | dsl <dsl@NetBSD.org> | 2009-01-16 20:50:24 +0000 |
| commit | e9eac4d91ea8917a2cb3cee9e20557c82c2502aa (patch) | |
| tree | 9a02713ca58b8d5299af46fe2916935fe5451730 /usr.bin/make/parse.c | |
| parent | 20e2f309c1ea9367a44c70724b48a9757967682a (diff) | |
Parse_Error() really doesn't need to cruft up a dummy structure for curFile.
It only needs the 'fname' and 'lineno' fields - so just use NULL/0 when
curFile is NULL.
Diffstat (limited to 'usr.bin/make/parse.c')
| -rw-r--r-- | usr.bin/make/parse.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index fcecc4456ef..910be0cbb64 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.155 2009/01/11 15:50:06 dsl Exp $ */ +/* $NetBSD: parse.c,v 1.156 2009/01/16 20:50:24 dsl Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: parse.c,v 1.155 2009/01/11 15:50:06 dsl Exp $"; +static char rcsid[] = "$NetBSD: parse.c,v 1.156 2009/01/16 20:50:24 dsl Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: parse.c,v 1.155 2009/01/11 15:50:06 dsl Exp $"); +__RCSID("$NetBSD: parse.c,v 1.156 2009/01/16 20:50:24 dsl Exp $"); #endif #endif /* not lint */ #endif @@ -475,31 +475,26 @@ void Parse_Error(int type, const char *fmt, ...) { va_list ap; + const char *fname; + size_t lineno; - va_start(ap, fmt); if (curFile == NULL) { - /* avoid segfault */ - static IFile intFile; - intFile.fd = -1; - curFile = &intFile; + fname = NULL; + lineno = 0; + } else { + fname = curFile->fname; + lineno = curFile->lineno; } - ParseVErrorInternal(stderr, curFile->fname, curFile->lineno, - type, fmt, ap); + + va_start(ap, fmt); + ParseVErrorInternal(stderr, fname, lineno, type, fmt, ap); va_end(ap); if (debug_file != stderr && debug_file != stdout) { va_start(ap, fmt); - ParseVErrorInternal(debug_file, curFile->fname, curFile->lineno, - type, fmt, ap); + ParseVErrorInternal(debug_file, fname, lineno, type, fmt, ap); va_end(ap); } - /* - * if we get this far, make sure we don't leave curFile - * pointing to our dummy one. - */ - if (curFile->fname == NULL) { - curFile = NULL; - } } /*- |
