* equalRuleLocks * * Determine whether two RuleLocks are equivalent * * Probably this should be in the rules code someplace... */
| 910 | * Probably this should be in the rules code someplace... |
| 911 | */ |
| 912 | static bool |
| 913 | equalRuleLocks(RuleLock *rlock1, RuleLock *rlock2) |
| 914 | { |
| 915 | int i; |
| 916 | |
| 917 | /* |
| 918 | * As of 7.3 we assume the rule ordering is repeatable, because |
| 919 | * RelationBuildRuleLock should read 'em in a consistent order. So just |
| 920 | * compare corresponding slots. |
| 921 | */ |
| 922 | if (rlock1 != NULL) |
| 923 | { |
| 924 | if (rlock2 == NULL) |
| 925 | return false; |
| 926 | if (rlock1->numLocks != rlock2->numLocks) |
| 927 | return false; |
| 928 | for (i = 0; i < rlock1->numLocks; i++) |
| 929 | { |
| 930 | RewriteRule *rule1 = rlock1->rules[i]; |
| 931 | RewriteRule *rule2 = rlock2->rules[i]; |
| 932 | |
| 933 | if (rule1->ruleId != rule2->ruleId) |
| 934 | return false; |
| 935 | if (rule1->event != rule2->event) |
| 936 | return false; |
| 937 | if (rule1->enabled != rule2->enabled) |
| 938 | return false; |
| 939 | if (rule1->isInstead != rule2->isInstead) |
| 940 | return false; |
| 941 | if (!equal(rule1->qual, rule2->qual)) |
| 942 | return false; |
| 943 | if (!equal(rule1->actions, rule2->actions)) |
| 944 | return false; |
| 945 | } |
| 946 | } |
| 947 | else if (rlock2 != NULL) |
| 948 | return false; |
| 949 | return true; |
| 950 | } |
| 951 | |
| 952 | /* |
| 953 | * equalPolicy |
no test coverage detected