Mercurial > ~dholland > hg > tradcpp > index.cgi
diff macro.c @ 25:18681e5ae6e4
fix some more bugs
author | David A. Holland |
---|---|
date | Mon, 20 Dec 2010 04:38:43 -0500 |
parents | e3fab8f1b52c |
children | 01c3a2088ab4 |
line wrap: on
line diff
--- a/macro.c Mon Dec 20 04:30:02 2010 -0500 +++ b/macro.c Mon Dec 20 04:38:43 2010 -0500 @@ -493,7 +493,7 @@ if (pos > blockstart) { ei = expansionitem_create_stringlen( buf + blockstart, - blockstart - pos); + pos - blockstart); expansionitemarray_add(&m->expansion, ei, NULL); } @@ -508,7 +508,7 @@ } if (pos > blockstart) { ei = expansionitem_create_stringlen(buf + blockstart, - blockstart - pos); + pos - blockstart); expansionitemarray_add(&m->expansion, ei, NULL); } } @@ -534,6 +534,7 @@ struct macro *m; m = macro_define_common_start(p1, macro, p3); + m->hasparams = true; macro_parse_parameters(m, p2, params); macro_parse_expansion(m, expansion); macro_define_common_end(m); @@ -734,6 +735,7 @@ } m = macrotable_find(stringarray_get(&es->args, 0), false); expand_send(es, p, (m != NULL) ? "1" : "0", 1); + expstate_destroyargs(es); return; } @@ -743,6 +745,7 @@ newbuf = expand_substitute(es); newbuf2 = macroexpand(p, newbuf, strlen(newbuf), false); free(newbuf); + expstate_destroyargs(es); doexpand(es, p, newbuf2, strlen(newbuf2)); free(newbuf2);