summaryrefslogtreecommitdiffstats
path: root/usr.bin/make
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2005-02-10 14:50:34 +0000
committerharti <harti@FreeBSD.org>2005-02-10 14:50:34 +0000
commit9c56ede2b6e0a88b71bf3805c99bcf68500f114d (patch)
tree54ba7a031d8c4b9432783ea8f06327a17bbaf38c /usr.bin/make
parent77cdf1ecc0171ba6e6aba3ab531d36c32d897da7 (diff)
downloadFreeBSD-src-9c56ede2b6e0a88b71bf3805c99bcf68500f114d.zip
FreeBSD-src-9c56ede2b6e0a88b71bf3805c99bcf68500f114d.tar.gz
Style nits:
Move some assignments nearer to where they actually used. Convert a loop from a for() to a while() to make it clearer and add braces to the long body of it. Split assignment from variable declaration. Submitted by: Max Okumoto <okumoto@ucsd.edu>
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/var.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index 40df884..f79f53b 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -946,29 +946,35 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, size_t *lengthPtr,
/* build up expanded variable name in this buffer */
Buffer *buf = Buf_Init(MAKE_BSIZE);
- startc = str[1];
- endc = (startc == OPEN_PAREN) ? CLOSE_PAREN : CLOSE_BRACE;
-
/*
* Skip to the end character or a colon, whichever comes first,
* replacing embedded variables as we go.
*/
- for (tstr = str + 2; *tstr != '\0' && *tstr != endc && *tstr != ':'; tstr++)
+ startc = str[1];
+ endc = (startc == OPEN_PAREN) ? CLOSE_PAREN : CLOSE_BRACE;
+
+ tstr = str + 2;
+ while (*tstr != '\0' && *tstr != endc && *tstr != ':') {
if (*tstr == '$') {
size_t rlen;
Boolean rfree;
- char *rval = Var_Parse(tstr, ctxt, err, &rlen, &rfree);
+ char *rval;
+ rval = Var_Parse(tstr, ctxt, err, &rlen, &rfree);
if (rval == var_Error) {
Fatal("Error expanding embedded variable.");
- } else if (rval != NULL) {
+ }
+ if (rval != NULL) {
Buf_Append(buf, rval);
if (rfree)
free(rval);
}
tstr += rlen - 1;
- } else
+ } else {
Buf_AddByte(buf, (Byte)*tstr);
+ }
+ tstr++;
+ }
if (*tstr == '\0') {
/*
OpenPOWER on IntegriCloud