]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: vars/compil: fix some warnings
authorThierry FOURNIER <tfournier@arpalert.org>
Tue, 16 Jun 2015 21:52:47 +0000 (23:52 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 17 Jun 2015 08:42:45 +0000 (10:42 +0200)
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]

src/vars.c

index cf3275cd381e1ba933ef841860f062cc043046b7..fe78c46a45a82a42ae93eaf2aa037b7a5997b031 100644 (file)
@@ -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. */