[core] const buffer * in config_check_cond_nocache
use (const buffer *) in config_check_cond_nocache()
@@ -510,7 +510,7 @@ static cond_result_t config_check_cond_nocache(request_st * const r, const data_
/* pass the rules */
- buffer *l;
+ const buffer *l;
switch (dc->comp) {
case COMP_HTTP_HOST:
@@ -591,28 +591,24 @@ static cond_result_t config_check_cond_nocache(request_st * const r, const data_
break;
case COMP_HTTP_REQUEST_HEADER:
- *((const buffer **)&l) =
- http_header_request_get(r, dc->ext, BUF_PTR_LEN(&dc->comp_tag));
+ l = http_header_request_get(r, dc->ext, BUF_PTR_LEN(&dc->comp_tag));
if (NULL == l) l = (buffer *)&empty_string;
break;
case COMP_HTTP_REQUEST_METHOD:
- l = r->tmp_buf;
- buffer_clear(l);
- http_method_append(l, r->http_method);
+ {
+ buffer * const tb = r->tmp_buf;
+ l = tb;
+ buffer_clear(tb);
+ http_method_append(tb, r->http_method);
+ }
break;
default:
return COND_RESULT_FALSE;
}
- if (NULL == l) { /*(should not happen)*/
- log_error(r->conf.errh, __FILE__, __LINE__,
- "%s compare to NULL", dc->comp_key);
- return COND_RESULT_FALSE;
- }
- else if (debug_cond) {
+ if (debug_cond)
log_error(r->conf.errh, __FILE__, __LINE__,
"%s compare to %s", dc->comp_key, l->ptr);
- }
switch(dc->cond) {
case CONFIG_COND_NE:
