CLEANUP: sample: remove useless tests in fetch functions for l4 != NULL
The stream may never be null given that all these functions are called
from sample_process(). Let's remove this now confusing test which
sometimes happens after a dereference was already done.
diff --git a/src/payload.c b/src/payload.c
index 3a2dc15..9d7774c 100644
--- a/src/payload.c
+++ b/src/payload.c
@@ -48,9 +48,6 @@
{
struct channel *chn;
- if (!s)
- return 0;
-
chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &s->res : &s->req;
if (!chn->buf)
return 0;
@@ -71,9 +68,6 @@
struct channel *chn;
const unsigned char *data;
- if (!s)
- goto not_ssl_hello;
-
chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &s->res : &s->req;
if (!chn->buf)
goto not_ssl_hello;
@@ -140,7 +134,7 @@
int version, bleft, msg_len;
const unsigned char *data;
- if (!s || !s->req.buf)
+ if (!s->req.buf)
return 0;
msg_len = 0;
@@ -277,9 +271,6 @@
struct channel *chn;
unsigned char *data;
- if (!s)
- goto not_ssl_hello;
-
chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &s->res : &s->req;
if (!chn->buf)
goto not_ssl_hello;
@@ -415,7 +406,7 @@
int bleft;
const unsigned char *data;
- if (!s || !s->req.buf)
+ if (!s->req.buf)
return 0;
smp->flags = SMP_F_CONST;
@@ -542,9 +533,6 @@
/* by default buf offset == len offset + len size */
/* buf offset could be absolute or relative to len offset + len size if prefixed by + or - */
- if (!s)
- return 0;
-
chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &s->res : &s->req;
if (!chn->buf)
return 0;
@@ -592,9 +580,6 @@
unsigned int buf_size = arg_p[1].data.uint;
struct channel *chn;
- if (!s)
- return 0;
-
chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &s->res : &s->req;
if (!chn->buf)
return 0;
diff --git a/src/proto_http.c b/src/proto_http.c
index 3e87470..f514928 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -10671,9 +10671,6 @@
smp_fetch_http_first_req(struct proxy *px, struct stream *s, void *l7, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
- if (!s)
- return 0;
-
smp->type = SMP_T_BOOL;
smp->data.uint = !(s->txn.flags & TX_NOT_FIRST);
return 1;
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 39d759e..e06e96d 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -3090,9 +3090,6 @@
struct connection *conn;
struct session *sess = l4->sess;
- if (!l4)
- return 0;
-
conn = objt_conn(sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@@ -3124,9 +3121,6 @@
struct session *sess = strm_sess(l4);
struct connection *conn;
- if (!l4)
- return 0;
-
conn = objt_conn(sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@@ -3173,9 +3167,6 @@
struct session *sess = strm_sess(l4);
struct connection *conn;
- if (!l4)
- return 0;
-
conn = objt_conn(sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@@ -3223,9 +3214,6 @@
struct session *sess = strm_sess(l4);
struct connection *conn;
- if (!l4)
- return 0;
-
conn = objt_conn(sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@@ -3271,9 +3259,6 @@
struct session *sess = strm_sess(l4);
struct connection *conn;
- if (!l4)
- return 0;
-
conn = objt_conn(sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@@ -3320,9 +3305,6 @@
struct session *sess = strm_sess(l4);
struct connection *conn;
- if (!l4)
- return 0;
-
conn = objt_conn(sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@@ -3383,9 +3365,6 @@
struct session *sess = strm_sess(l4);
struct connection *conn;
- if (!l4)
- return 0;
-
conn = objt_conn(sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@@ -3432,9 +3411,6 @@
struct session *sess = strm_sess(l4);
struct connection *conn;
- if (!l4)
- return 0;
-
conn = objt_conn(sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@@ -3489,9 +3465,6 @@
struct session *sess = strm_sess(l4);
struct connection *conn;
- if (!l4)
- return 0;
-
conn = objt_conn(sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@@ -3525,9 +3498,6 @@
struct session *sess = strm_sess(l4);
struct connection *conn;
- if (!l4)
- return 0;
-
conn = objt_conn(sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@@ -3567,9 +3537,6 @@
struct session *sess = strm_sess(l4);
struct connection *conn;
- if (!l4)
- return 0;
-
conn = objt_conn(sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@@ -3620,9 +3587,6 @@
struct session *sess = strm_sess(l4);
struct connection *conn;
- if (!l4)
- return 0;
-
conn = objt_conn(sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@@ -3706,9 +3670,6 @@
smp->flags = 0;
- if (!l4)
- return 0;
-
conn = objt_conn(l4->si[back_conn].end);
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0;
@@ -3738,9 +3699,6 @@
smp->flags = 0;
- if (!l4)
- return 0;
-
conn = objt_conn(l4->si[back_conn].end);
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0;
@@ -3766,9 +3724,6 @@
smp->flags = 0;
- if (!l4)
- return 0;
-
conn = objt_conn(l4->si[back_conn].end);
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0;
@@ -3793,9 +3748,6 @@
smp->flags = SMP_F_CONST;
smp->type = SMP_T_STR;
- if (!l4)
- return 0;
-
conn = objt_conn(sess->origin);
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0;
@@ -3822,9 +3774,6 @@
smp->flags = SMP_F_CONST;
smp->type = SMP_T_STR;
- if (!l4)
- return 0;
-
conn = objt_conn(sess->origin);
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0;
@@ -3853,9 +3802,6 @@
smp->flags = 0;
- if (!l4)
- return 0;
-
conn = objt_conn(l4->si[back_conn].end);
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0;
@@ -3887,9 +3833,6 @@
smp->flags = SMP_F_CONST;
smp->type = SMP_T_BIN;
- if (!l4)
- return 0;
-
conn = objt_conn(l4->si[back_conn].end);
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0;
@@ -3919,9 +3862,6 @@
smp->flags = SMP_F_CONST;
smp->type = SMP_T_STR;
- if (!l4)
- return 0;
-
conn = objt_conn(sess->origin);
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0;
@@ -3949,9 +3889,6 @@
smp->flags = 0;
- if (!l4)
- return 0;
-
conn = objt_conn(l4->si[back_conn].end);
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0;
@@ -3988,9 +3925,6 @@
struct session *sess = strm_sess(l4);
struct connection *conn;
- if (!l4)
- return 0;
-
conn = objt_conn(sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@@ -4015,9 +3949,6 @@
struct session *sess = strm_sess(l4);
struct connection *conn;
- if (!l4)
- return 0;
-
conn = objt_conn(sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@@ -4042,9 +3973,6 @@
struct session *sess = strm_sess(l4);
struct connection *conn;
- if (!l4)
- return 0;
-
conn = objt_conn(sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@@ -4069,9 +3997,6 @@
struct session *sess = strm_sess(l4);
struct connection *conn;
- if (!l4)
- return 0;
-
conn = objt_conn(sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;