1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Push down variables into local scope in Var_Parse to make their

liveness clear for splitting up this monster function.

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
This commit is contained in:
Hartmut Brandt 2005-02-18 07:33:43 +00:00
parent e6f328fb03
commit 1aaa4432a5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=142038

View File

@ -869,23 +869,16 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, size_t *lengthPtr,
{
char *tstr; /* Pointer into str */
Var *v; /* Variable in invocation */
char *cp; /* Secondary pointer into str (place marker
* for tstr) */
Boolean haveModifier; /* TRUE if have modifiers for the variable */
char endc; /* Ending character when variable in parens
* or braces */
char startc; /* Starting character when variable in parens
* or braces */
int cnt; /* Used to count brace pairs when variable in
* in parens or braces */
char *start;
char delim;
Boolean dynamic; /* TRUE if the variable is local and we're
* expanding it in a non-local context. This
* is done to support dynamic sources. The
* result is just the invocation, unaltered */
int vlen; /* length of variable name, after embedded
* variable expansion */
*freePtr = FALSE;
dynamic = FALSE;
@ -903,6 +896,8 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, size_t *lengthPtr,
/*
* Check if brackets contain a variable name.
*/
int vlen; /* length of variable name, after embedded variable
* expansion */
/* build up expanded variable name in this buffer */
Buffer *buf = Buf_Init(MAKE_BSIZE);
@ -1175,6 +1170,7 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, size_t *lengthPtr,
* :L Converts variable to lower-case.
*/
if ((str != NULL) && haveModifier) {
char *cp;
/*
* Skip initial colon while putting it back.
*/
@ -1410,6 +1406,7 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, size_t *lengthPtr,
}
case 'C':
{
int delim;
VarREPattern pattern;
char *re;
int error;
@ -1591,6 +1588,7 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, size_t *lengthPtr,
*/
VarPattern pattern;
Boolean eqFound;
int cnt;
pattern.flags = 0;
eqFound = FALSE;
@ -1614,6 +1612,7 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, size_t *lengthPtr,
cp++;
}
if (*cp == endc && eqFound) {
int delim;
/*
* Now we break this sucker into the lhs and