Push the assignments of some variables down into the sub-blocks where
it is actually needed. This makes clear in which subblocks the variables are not needed and which can easier be split out. Submitted by: Max Okumoto <okumoto@ucsd.edu>
This commit is contained in:
parent
1bfca411a6
commit
7f2e1af188
@ -880,14 +880,11 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, size_t *lengthPtr,
|
|||||||
* is done to support dynamic sources. The
|
* is done to support dynamic sources. The
|
||||||
* result is just the invocation, unaltered */
|
* result is just the invocation, unaltered */
|
||||||
|
|
||||||
*freePtr = FALSE;
|
|
||||||
dynamic = FALSE;
|
|
||||||
start = str;
|
|
||||||
|
|
||||||
if (str[1] == '\0') {
|
if (str[1] == '\0') {
|
||||||
/*
|
/*
|
||||||
* Error - there is only a dollar sign!
|
* Error - there is only a dollar sign!
|
||||||
*/
|
*/
|
||||||
|
*freePtr = FALSE;
|
||||||
*lengthPtr = 1;
|
*lengthPtr = 1;
|
||||||
return (err ? var_Error : varNoError);
|
return (err ? var_Error : varNoError);
|
||||||
}
|
}
|
||||||
@ -938,12 +935,14 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, size_t *lengthPtr,
|
|||||||
* right now, setting the length to be the distance to
|
* right now, setting the length to be the distance to
|
||||||
* the end of the string, since that's what make does.
|
* the end of the string, since that's what make does.
|
||||||
*/
|
*/
|
||||||
|
*freePtr = FALSE;
|
||||||
*lengthPtr = tstr - str;
|
*lengthPtr = tstr - str;
|
||||||
return (var_Error);
|
return (var_Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
haveModifier = (*tstr == ':');
|
haveModifier = (*tstr == ':');
|
||||||
*tstr = '\0'; /* modify input string */
|
*tstr = '\0'; /* modify input string */
|
||||||
|
start = str;
|
||||||
|
|
||||||
Buf_AddByte(buf, (Byte)'\0');
|
Buf_AddByte(buf, (Byte)'\0');
|
||||||
str = Buf_GetAll(buf, (size_t *)NULL); /* REPLACE str */
|
str = Buf_GetAll(buf, (size_t *)NULL); /* REPLACE str */
|
||||||
@ -1028,6 +1027,7 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, size_t *lengthPtr,
|
|||||||
dynamic = TRUE;
|
dynamic = TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
dynamic = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if ((vlen > 2) && (str[0] == '.') &&
|
} else if ((vlen > 2) && (str[0] == '.') &&
|
||||||
@ -1043,7 +1043,11 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, size_t *lengthPtr,
|
|||||||
(strncmp(str, ".MEMBER", len) == 0))
|
(strncmp(str, ".MEMBER", len) == 0))
|
||||||
{
|
{
|
||||||
dynamic = TRUE;
|
dynamic = TRUE;
|
||||||
|
} else {
|
||||||
|
dynamic = FALSE;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
dynamic = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (haveModifier) {
|
if (haveModifier) {
|
||||||
@ -1067,11 +1071,15 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, size_t *lengthPtr,
|
|||||||
Buf_Destroy(buf, TRUE);
|
Buf_Destroy(buf, TRUE);
|
||||||
return (str);
|
return (str);
|
||||||
} else {
|
} else {
|
||||||
|
*freePtr = FALSE;
|
||||||
Buf_Destroy(buf, TRUE);
|
Buf_Destroy(buf, TRUE);
|
||||||
return (err ? var_Error : varNoError);
|
return (err ? var_Error : varNoError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
dynamic = FALSE;
|
||||||
}
|
}
|
||||||
|
*freePtr = FALSE;
|
||||||
Buf_Destroy(buf, TRUE);
|
Buf_Destroy(buf, TRUE);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -1116,8 +1124,12 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, size_t *lengthPtr,
|
|||||||
/*
|
/*
|
||||||
* Error
|
* Error
|
||||||
*/
|
*/
|
||||||
|
*freePtr = FALSE;
|
||||||
return (err ? var_Error : varNoError);
|
return (err ? var_Error : varNoError);
|
||||||
}
|
}
|
||||||
|
dynamic = FALSE;
|
||||||
|
start = str;
|
||||||
|
*freePtr = FALSE;
|
||||||
haveModifier = FALSE;
|
haveModifier = FALSE;
|
||||||
startc = 0;
|
startc = 0;
|
||||||
endc = str[1];
|
endc = str[1];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user