Make the intention of a loop clearer.

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
This commit is contained in:
Hartmut Brandt 2005-02-07 15:51:51 +00:00
parent 9ca72ab21e
commit b3c3341784

View File

@ -1753,15 +1753,16 @@ Var_Subst(const char *var, char *str, GNode *ctxt, Boolean undefErr)
str++;
Buf_AddByte(buf, (Byte)*str);
str++;
} else if (*str != '$') {
} else if (str[0] != '$') {
/*
* Skip as many characters as possible -- either to the end of
* the string or to the next dollar sign (variable invocation).
*/
const char *cp;
const char *cp = str;
for (cp = str++; *str != '$' && *str != '\0'; str++)
continue;
do {
str++;
} while (str[0] != '$' && str[0] != '\0');
Buf_AppendRange(buf, cp, str);
} else {
if (var != NULL) {