comparison src/lib/var-expand-if.c @ 22542:74fdc86524ef

lib: Fix static analyzer warnings in var-expand-if
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Tue, 25 Jul 2017 09:43:56 +0300
parents 1fc29e34ee3d
children 4dd4e41cd4a1
comparison
equal deleted inserted replaced
22541:1fc29e34ee3d 22542:74fdc86524ef
131 case OP_STR_NOT_LIKE: 131 case OP_STR_NOT_LIKE:
132 *result_r = !wildcard_match(lhs, rhs); 132 *result_r = !wildcard_match(lhs, rhs);
133 return 0; 133 return 0;
134 case OP_STR_NOT_REGEXP: 134 case OP_STR_NOT_REGEXP:
135 neg = TRUE; 135 neg = TRUE;
136 /* fall through */
136 case OP_STR_REGEXP: { 137 case OP_STR_REGEXP: {
137 int ec; 138 int ec;
138 bool res; 139 bool res;
139 regex_t reg; 140 regex_t reg;
140 if ((ec = regcomp(&reg, rhs, REG_EXTENDED)) != 0) { 141 if ((ec = regcomp(&reg, rhs, REG_EXTENDED)) != 0) {
155 regfree(&reg); 156 regfree(&reg);
156 /* this should be same as neg. 157 /* this should be same as neg.
157 if NOT_REGEXP, neg == TRUE and res should be FALSE 158 if NOT_REGEXP, neg == TRUE and res should be FALSE
158 if REGEXP, ned == FALSE, and res should be TRUE 159 if REGEXP, ned == FALSE, and res should be TRUE
159 */ 160 */
160 *result_r = !res == neg; 161 *result_r = res != neg;
161 return 0; 162 return 0;
162 } 163 }
163 default: 164 default:
164 i_panic("Missing generic comparator %u", op); 165 i_panic("Missing generic comparator %u", op);
165 } 166 }