diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-07-24 18:52:48 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-07-24 18:52:48 +0000 |
commit | 98982aacf0aa7545ab1423f476775a35cb6b63a1 (patch) | |
tree | 09e35dfccd9c5b3a0df3abdf9406f6480f7b15b0 /usr.bin/make/var.c | |
parent | ee4d80f5e59727a3f7a3986c1ecfce78aaac6ac9 (diff) |
change Var_ParseSkip API to increment the position instead of returning a
length, simplifies code.
(warns a bit, symptom of some further issues to fix).
okay millert@
Diffstat (limited to 'usr.bin/make/var.c')
-rw-r--r-- | usr.bin/make/var.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c index 559f82d5076..1f135dab8bd 100644 --- a/usr.bin/make/var.c +++ b/usr.bin/make/var.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: var.c,v 1.67 2007/07/22 17:56:50 espie Exp $ */ +/* $OpenBSD: var.c,v 1.68 2007/07/24 18:52:47 espie Exp $ */ /* $NetBSD: var.c,v 1.18 1997/03/18 19:24:46 christos Exp $ */ /* @@ -818,15 +818,17 @@ find_pos(int c) } } -size_t -Var_ParseSkip(const char *str, SymTable *ctxt, bool *result) +bool +Var_ParseSkip(const char **pstr, SymTable *ctxt) { - const char *tstr; /* Pointer into str */ - Var *v; /* Variable in invocation */ - char paren; /* Parenthesis or brace or nothing */ + const char *tstr; + Var *v; + char paren; + const char *str = *pstr; const char *start; size_t length; struct Name name; + bool result; v = NULL; start = str; @@ -849,14 +851,13 @@ Var_ParseSkip(const char *str, SymTable *ctxt, bool *result) length++; } - if (result != NULL) - *result = true; + result = true; if (*tstr == ':' && paren != '\0') if (VarModifiers_Apply(NULL, NULL, ctxt, true, NULL, tstr, paren, &length) == var_Error) - if (result != NULL) - *result = false; - return length; + result = false; + *pstr += length; + return result; } /* As of now, Var_ParseBuffer is just a wrapper around Var_Parse. For |