mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-18 19:56:59 +00:00
MINOR: cache: Remove useless test for nonzero.
Don't bother testing if len is nonzero, we know it is, as we're in the "else" part of a if (!len), and testing it confuses clang into thinking ret may be left uninitialized.
This commit is contained in:
parent
7da120bb0e
commit
cd2867a012
40
src/cache.c
40
src/cache.c
@ -173,29 +173,27 @@ cache_store_http_forward_data(struct stream *s, struct filter *filter,
|
||||
}
|
||||
else {
|
||||
/* Forward trailers data */
|
||||
if (len) {
|
||||
if (filter->ctx && st->first_block) {
|
||||
/* disable buffering if too much data (never greater than a buffer size */
|
||||
if (len > global.tune.bufsize - global.tune.maxrewrite - st->first_block->len) {
|
||||
filter->ctx = NULL; /* disable cache */
|
||||
shctx_lock(shctx);
|
||||
shctx_row_dec_hot(shctx, st->first_block);
|
||||
shctx_unlock(shctx);
|
||||
pool_free2(pool2_cache_st, st);
|
||||
ret = 0;
|
||||
} else {
|
||||
|
||||
int blen;
|
||||
blen = shctx_row_data_append(shctx,
|
||||
st->first_block,
|
||||
(unsigned char *)bi_ptr(msg->chn->buf),
|
||||
MIN(bi_contig_data(msg->chn->buf), len));
|
||||
|
||||
ret = MIN(bi_contig_data(msg->chn->buf), len) + blen;
|
||||
}
|
||||
if (filter->ctx && st->first_block) {
|
||||
/* disable buffering if too much data (never greater than a buffer size */
|
||||
if (len > global.tune.bufsize - global.tune.maxrewrite - st->first_block->len) {
|
||||
filter->ctx = NULL; /* disable cache */
|
||||
shctx_lock(shctx);
|
||||
shctx_row_dec_hot(shctx, st->first_block);
|
||||
shctx_unlock(shctx);
|
||||
pool_free2(pool2_cache_st, st);
|
||||
ret = 0;
|
||||
} else {
|
||||
ret = len;
|
||||
|
||||
int blen;
|
||||
blen = shctx_row_data_append(shctx,
|
||||
st->first_block,
|
||||
(unsigned char *)bi_ptr(msg->chn->buf),
|
||||
MIN(bi_contig_data(msg->chn->buf), len));
|
||||
|
||||
ret = MIN(bi_contig_data(msg->chn->buf), len) + blen;
|
||||
}
|
||||
} else {
|
||||
ret = len;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user