- lineNode *cl = NULL;
- lineNode *pl = NULL , *lhead = NULL;
- char lb[MAX_PATTERN_LEN];
- char *lbp;
- lineNode *comment = NULL;
-
- /* collect all the comment lines in the source */
- for (cl = *shead ; cl != stail ; cl = cl->next) {
- if (cl->line && ( *cl->line == ';' || cl->isDebug)) {
- pl = (pl ? connectLine (pl,newLineNode(cl->line)) :
- (comment = newLineNode(cl->line)));
- pl->isDebug = cl->isDebug;
- }
- }
- cl = NULL;
-
- /* for all the lines in the replacement pattern do */
- for ( pl = pr->replace ; pl ; pl = pl->next ) {
- char *v;
- char *l;
- lbp = lb;
-
- l = pl->line;
- while (*l) {
- /* if the line contains a variable */
- if (*l == '%' && isdigit(*(l+1))) {
- v = hTabItemWithKey(pr->vars,keyForVar(l+1));
- if (!v) {
- fprintf(stderr,"used unbound variable in replacement\n");
- l++;
- continue;
- }
- while (*v)
- *lbp++ = *v++;
- l++;
- while (isdigit(*l)) l++;
- continue ;
- }
- *lbp++ = *l++;
+ lineNode *cl = NULL;
+ lineNode *pl = NULL, *lhead = NULL;
+ /* a long function name and long variable name can evaluate to
+ 4x max pattern length e.g. "mov dptr,((fie_var>>8)<<8)+fie_var" */
+ char lb[MAX_PATTERN_LEN*4];
+ char *lbp;
+ lineNode *comment = NULL;
+
+ /* collect all the comment lines in the source */
+ for (cl = *shead; cl != stail; cl = cl->next)
+ {
+ if (cl->line && (*cl->line == ';' || cl->isDebug))
+ {
+ pl = (pl ? connectLine (pl, newLineNode (cl->line)) :
+ (comment = newLineNode (cl->line)));
+ pl->isDebug = cl->isDebug;
+ }