From: Thierry FOURNIER Date: Tue, 16 Jun 2015 21:52:47 +0000 (+0200) Subject: BUG/MINOR: vars/compil: fix some warnings X-Git-Tag: v1.6-dev2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0b243fd63b78e5e02e7aeb88ebfb997742d15cc1;p=thirdparty%2Fhaproxy.git BUG/MINOR: vars/compil: fix some warnings A switch case doesn't have default entry, and the compilator sends a warning about uninitilized var. warning: 'vars' may be used uninitialized in this function [-Wmaybe-uninitialized] --- diff --git a/src/vars.c b/src/vars.c index cf3275cd38..fe78c46a45 100644 --- a/src/vars.c +++ b/src/vars.c @@ -205,7 +205,8 @@ static int smp_fetch_var(const struct arg *args, struct sample *smp, const char case SCOPE_SESS: vars = &smp->strm->vars_sess; break; case SCOPE_TXN: vars = &smp->strm->vars_txn; break; case SCOPE_REQ: - case SCOPE_RES: vars = &smp->strm->vars_reqres; break; + case SCOPE_RES: + default: vars = &smp->strm->vars_reqres; break; } if (vars->scope != var_desc->scope) return 0; @@ -320,7 +321,8 @@ static inline int sample_store_stream(const char *name, enum vars_scope scope, case SCOPE_SESS: vars = &strm->vars_sess; break; case SCOPE_TXN: vars = &strm->vars_txn; break; case SCOPE_REQ: - case SCOPE_RES: vars = &strm->vars_reqres; break; + case SCOPE_RES: + default: vars = &strm->vars_reqres; break; } if (vars->scope != scope) return 0; @@ -395,7 +397,8 @@ int vars_get_by_name(const char *name, size_t len, struct stream *strm, struct s case SCOPE_SESS: vars = &strm->vars_sess; break; case SCOPE_TXN: vars = &strm->vars_txn; break; case SCOPE_REQ: - case SCOPE_RES: vars = &strm->vars_reqres; break; + case SCOPE_RES: + default: vars = &strm->vars_reqres; break; } /* Check if the scope is avalaible a this point of processing. */