diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2021-06-20 11:36:13 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2021-08-27 02:16:54 -0400 |
commit | a3f5fa3ff665d916227c211e1403d631337b40d4 (patch) | |
tree | e6ff7d1b45fbce357ad4c43796993be1a895194b /src/configfile-glue.c | |
parent | 9fe8fbaa72451ebdbfa1a30c73a5e4f37f6dc205 (diff) | |
download | lighttpd-git-a3f5fa3ff665d916227c211e1403d631337b40d4.tar.gz |
[core] config_check_cond_nocache() xor return code
Diffstat (limited to 'src/configfile-glue.c')
-rw-r--r-- | src/configfile-glue.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/configfile-glue.c b/src/configfile-glue.c index 6bf1fbf7..c8debfbd 100644 --- a/src/configfile-glue.c +++ b/src/configfile-glue.c @@ -551,30 +551,24 @@ static cond_result_t config_check_cond_nocache(request_st * const r, const data_ log_error(r->conf.errh, __FILE__, __LINE__, "%s compare to %s", dc->comp_key, l->ptr); + int match; switch(dc->cond) { case CONFIG_COND_NE: case CONFIG_COND_EQ: - if (buffer_is_equal(l, &dc->string)) { - return (dc->cond == CONFIG_COND_EQ) ? COND_RESULT_TRUE : COND_RESULT_FALSE; - } else { - return (dc->cond == CONFIG_COND_EQ) ? COND_RESULT_FALSE : COND_RESULT_TRUE; - } + match = (dc->cond == CONFIG_COND_EQ); + match ^= (buffer_is_equal(l, &dc->string)); + break; case CONFIG_COND_NOMATCH: case CONFIG_COND_MATCH: { cond_match_t *cond_match = r->cond_match + dc->context_ndx; - if (data_config_pcre_exec(dc, cache, l, cond_match) > 0) { - return (dc->cond == CONFIG_COND_MATCH) ? COND_RESULT_TRUE : COND_RESULT_FALSE; - } else { - /* cache is already cleared */ - return (dc->cond == CONFIG_COND_MATCH) ? COND_RESULT_FALSE : COND_RESULT_TRUE; - } + match = (dc->cond == CONFIG_COND_MATCH); + match ^= (data_config_pcre_exec(dc, cache, l, cond_match) > 0); + break; } default: - /* no way */ - break; + return COND_RESULT_FALSE; } - - return COND_RESULT_FALSE; + return match ? COND_RESULT_FALSE : COND_RESULT_TRUE; } __attribute_noinline__ |