1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-30 16:51:41 +00:00

Reverse a condition so that the else clause can be changed

to a fallthrough.

Patch:		7.82

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
This commit is contained in:
Hartmut Brandt 2005-03-01 07:58:18 +00:00
parent 2ece8174c1
commit aeadeefcdf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=142881

View File

@ -1679,55 +1679,23 @@ VarParseLong(char foo[], GNode *ctxt, Boolean err, size_t *lengthPtr,
}
}
/**
* If it's not bounded by braces of some sort, life is much simpler.
* We just need to check for the first character and return the value
* if it exists.
*/
static char *
VarParseShort(const char input[], GNode *ctxt, Boolean err, size_t *lengthPtr,
Boolean *freePtr)
{
/*
* If it's not bounded by braces of some sort, life is much simpler.
* We just need to check for the first character and return the value
* if it exists.
*/
Var *v; /* Variable in invocation */
char name[2];
Var *v;
name[0] = input[1];
name[1] = '\0';
v = VarFind(name, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
if (v == NULL) {
if ((ctxt == VAR_CMD) || (ctxt == VAR_GLOBAL)) {
/*
* If substituting a local variable in a non-local
* context, assume it's for dynamic source stuff. We
* have to handle this specially and return the
* longhand for the variable with the dollar sign
* escaped so it makes it back to the caller. Only
* four of the local variables are treated specially
* as they are the only four that will be set when
* dynamic sources are expanded.
*/
/* XXX: It looks like $% and $! are reversed here */
*freePtr = FALSE;
*lengthPtr = 2;
switch (input[1]) {
case '@':
return ("$(.TARGET)");
case '%':
return ("$(.ARCHIVE)");
case '*':
return ("$(.PREFIX)");
case '!':
return ("$(.MEMBER)");
default:
return (err ? var_Error : varNoError);
}
} else {
*freePtr = FALSE;
*lengthPtr = 2;
return (err ? var_Error : varNoError);
}
} else {
if (v != NULL) {
char *result;
result = VarExpand(v, ctxt, err);
@ -1740,6 +1708,37 @@ VarParseShort(const char input[], GNode *ctxt, Boolean err, size_t *lengthPtr,
*lengthPtr = 2;
return (result);
}
/*
* If substituting a local variable in a non-local context, assume
* it's for dynamic source stuff. We have to handle this specially
* and return the longhand for the variable with the dollar sign
* escaped so it makes it back to the caller. Only four of the local
* variables are treated specially as they are the only four that
* will be set when dynamic sources are expanded.
*/
if ((ctxt == VAR_CMD) || (ctxt == VAR_GLOBAL)) {
*freePtr = FALSE;
*lengthPtr = 2;
/* XXX: It looks like $% and $! are reversed here */
switch (input[1]) {
case '@':
return ("$(.TARGET)");
case '%':
return ("$(.ARCHIVE)");
case '*':
return ("$(.PREFIX)");
case '!':
return ("$(.MEMBER)");
default:
return (err ? var_Error : varNoError);
}
}
*freePtr = FALSE;
*lengthPtr = 2;
return (err ? var_Error : varNoError);
}
/*-