MCPcopy Create free account
hub / github.com/Entware/Entware / expr_eliminate_eq

Function expr_eliminate_eq

scripts/config/expr.c:221–241  ·  view source on GitHub ↗

* Rewrites the expressions 'ep1' and 'ep2' to remove operands common to both. * Example reductions: * * ep1: A && B -> ep1: y * ep2: A && B && C -> ep2: C * * ep1: A || B -> ep1: n * ep2: A || B || C -> ep2: C * * ep1: A && (B && FOO) -> ep1: FOO * ep2: (BAR && B) && A -> ep2: BAR * * ep1: A && (B || C) -> ep1: y * ep2: (C || B) && A -> ep

Source from the content-addressed store, hash-verified

219 * See __expr_eliminate_eq() as well.
220 */
221void expr_eliminate_eq(struct expr **ep1, struct expr **ep2)
222{
223 if (!e1 || !e2)
224 return;
225 switch (e1->type) {
226 case E_OR:
227 case E_AND:
228 __expr_eliminate_eq(e1->type, ep1, ep2);
229 default:
230 ;
231 }
232 if (e1->type != e2->type) switch (e2->type) {
233 case E_OR:
234 case E_AND:
235 __expr_eliminate_eq(e2->type, ep1, ep2);
236 default:
237 ;
238 }
239 e1 = expr_eliminate_yn(e1);
240 e2 = expr_eliminate_yn(e2);
241}
242
243#undef e1
244#undef e2

Callers 2

expr_eqFunction · 0.85
menu_finalizeFunction · 0.85

Calls 2

__expr_eliminate_eqFunction · 0.85
expr_eliminate_ynFunction · 0.85

Tested by

no test coverage detected