=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/make/var.c,v retrieving revision 1.73 retrieving revision 1.74 diff -u -r1.73 -r1.74 --- src/usr.bin/make/var.c 2007/07/30 09:51:53 1.73 +++ src/usr.bin/make/var.c 2007/07/30 10:03:11 1.74 @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: var.c,v 1.73 2007/07/30 09:51:53 espie Exp $ */ +/* $OpenBSD: var.c,v 1.74 2007/07/30 10:03:11 espie Exp $ */ /* $NetBSD: var.c,v 1.18 1997/03/18 19:24:46 christos Exp $ */ /* @@ -1104,7 +1104,23 @@ return Buf_Retrieve(&buf); } +static BUFFER subst_buffer; +/* we would like to subst on intervals, but it's complicated, so we cheat + * by storing the interval in a static buffer. + */ +char * +Var_Substi(const char *str, const char *estr, SymTable *ctxt, bool undefErr) +{ + /* delimited string: no need to copy */ + if (estr == NULL || *estr == '\0') + return Var_Subst(str, ctxt, undefErr); + + Buf_Reset(&subst_buffer); + Buf_Addi(&subst_buffer, str, estr); + return Var_Subst(Buf_Retrieve(&subst_buffer), ctxt, undefErr); +} + /*** *** Supplementary support for .for loops. ***/ @@ -1262,6 +1278,7 @@ Var_setCheckEnvFirst(false); VarModifiers_Init(); + Buf_Init(&subst_buffer, MAKE_BSIZE); }