comparison lwlib/lw_expr.c @ 200:348e2816ce32

Short ciruit some recursion in expression library
author William Astle <lost@l-w.ca>
date Fri, 16 Mar 2012 19:44:12 -0600
parents db5690682eb7
children 1f1a28b797e1
comparison
equal deleted inserted replaced
199:3132b1742eca 200:348e2816ce32
674 } 674 }
675 } 675 }
676 676
677 // simplify operands 677 // simplify operands
678 for (o = E -> operands; o; o = o -> next) 678 for (o = E -> operands; o; o = o -> next)
679 lw_expr_simplify_l(o -> p, priv); 679 if (o -> p -> type != lw_expr_type_int)
680 lw_expr_simplify_l(o -> p, priv);
680 681
681 for (o = E -> operands; o; o = o -> next) 682 for (o = E -> operands; o; o = o -> next)
682 { 683 {
683 if (o -> p -> type != lw_expr_type_int) 684 if (o -> p -> type != lw_expr_type_int)
684 break; 685 break;
1068 (level)--; 1069 (level)--;
1069 } 1070 }
1070 1071
1071 void lw_expr_simplify(lw_expr_t E, void *priv) 1072 void lw_expr_simplify(lw_expr_t E, void *priv)
1072 { 1073 {
1074 if (E -> type == lw_expr_type_int)
1075 return;
1073 lw_expr_simplify_l(E, priv); 1076 lw_expr_simplify_l(E, priv);
1074 } 1077 }
1075 1078
1076 /* 1079 /*
1077 1080