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

Function expr_eliminate_dups

scripts/config/expr.c:664–686  ·  view source on GitHub ↗

* Rewrites 'e' in-place to remove ("join") duplicate and other redundant * operands. * * Example simplifications: * * A || B || A -> A || B * A && B && A=y -> A=y && B * * Returns the deduplicated expression. */

Source from the content-addressed store, hash-verified

662 * Returns the deduplicated expression.
663 */
664struct expr *expr_eliminate_dups(struct expr *e)
665{
666 int oldcount;
667 if (!e)
668 return e;
669
670 oldcount = trans_count;
671 while (1) {
672 trans_count = 0;
673 switch (e->type) {
674 case E_OR: case E_AND:
675 expr_eliminate_dups1(e->type, &e, &e);
676 default:
677 ;
678 }
679 if (!trans_count)
680 /* No simplifications done in this pass. We're done */
681 break;
682 e = expr_eliminate_yn(e);
683 }
684 trans_count = oldcount;
685 return e;
686}
687
688/*
689 * Performs various simplifications involving logical operators and

Callers 1

menu_finalizeFunction · 0.85

Calls 2

expr_eliminate_dups1Function · 0.85
expr_eliminate_ynFunction · 0.85

Tested by

no test coverage detected