MEDIUM: sample change the prototype of sample-fetches and converters functions
This patch removes the structs "session", "stream" and "proxy" from
the sample-fetches and converters function prototypes.
This permits to remove some weight in the prototype call.
diff --git a/src/backend.c b/src/backend.c
index 17a55d6..08389df 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -1486,9 +1486,11 @@
* undefined behaviour.
*/
static int
-smp_fetch_nbsrv(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
- const struct arg *args, struct sample *smp, const char *kw, void *private)
+smp_fetch_nbsrv(unsigned int opt, const struct arg *args, struct sample *smp,
+ const char *kw, void *private)
{
+ struct proxy *px;
+
smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT;
px = args->data.prx;
@@ -1509,8 +1511,8 @@
* undefined behaviour.
*/
static int
-smp_fetch_srv_is_up(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
- const struct arg *args, struct sample *smp, const char *kw, void *private)
+smp_fetch_srv_is_up(unsigned int opt, const struct arg *args, struct sample *smp,
+ const char *kw, void *private)
{
struct server *srv = args->data.srv;
@@ -1529,8 +1531,8 @@
* undefined behaviour.
*/
static int
-smp_fetch_connslots(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
- const struct arg *args, struct sample *smp, const char *kw, void *private)
+smp_fetch_connslots(unsigned int opt, const struct arg *args, struct sample *smp,
+ const char *kw, void *private)
{
struct server *iterator;
@@ -1557,25 +1559,25 @@
/* set temp integer to the id of the backend */
static int
-smp_fetch_be_id(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
- const struct arg *args, struct sample *smp, const char *kw, void *private)
+smp_fetch_be_id(unsigned int opt, const struct arg *args, struct sample *smp,
+ const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TXN;
smp->type = SMP_T_UINT;
- smp->data.uint = strm->be->uuid;
+ smp->data.uint = smp->strm->be->uuid;
return 1;
}
/* set temp integer to the id of the server */
static int
-smp_fetch_srv_id(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
- const struct arg *args, struct sample *smp, const char *kw, void *private)
+smp_fetch_srv_id(unsigned int opt, const struct arg *args, struct sample *smp,
+ const char *kw, void *private)
{
- if (!objt_server(strm->target))
+ if (!objt_server(smp->strm->target))
return 0;
smp->type = SMP_T_UINT;
- smp->data.uint = objt_server(strm->target)->puid;
+ smp->data.uint = objt_server(smp->strm->target)->puid;
return 1;
}
@@ -1585,8 +1587,8 @@
* undefined behaviour.
*/
static int
-smp_fetch_be_sess_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
- const struct arg *args, struct sample *smp, const char *kw, void *private)
+smp_fetch_be_sess_rate(unsigned int opt, const struct arg *args, struct sample *smp,
+ const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT;
@@ -1599,8 +1601,8 @@
* undefined behaviour.
*/
static int
-smp_fetch_be_conn(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
- const struct arg *args, struct sample *smp, const char *kw, void *private)
+smp_fetch_be_conn(unsigned int opt, const struct arg *args, struct sample *smp,
+ const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT;
@@ -1613,8 +1615,8 @@
* undefined behaviour.
*/
static int
-smp_fetch_queue_size(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
- const struct arg *args, struct sample *smp, const char *kw, void *private)
+smp_fetch_queue_size(unsigned int opt, const struct arg *args, struct sample *smp,
+ const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT;
@@ -1631,10 +1633,11 @@
* undefined behaviour.
*/
static int
-smp_fetch_avg_queue_size(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
- const struct arg *args, struct sample *smp, const char *kw, void *private)
+smp_fetch_avg_queue_size(unsigned int opt, const struct arg *args, struct sample *smp,
+ const char *kw, void *private)
{
int nbsrv;
+ struct proxy *px;
smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT;
@@ -1660,8 +1663,8 @@
* undefined behaviour.
*/
static int
-smp_fetch_srv_conn(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
- const struct arg *args, struct sample *smp, const char *kw, void *private)
+smp_fetch_srv_conn(unsigned int opt, const struct arg *args, struct sample *smp,
+ const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT;
@@ -1674,8 +1677,8 @@
* undefined behaviour.
*/
static int
-smp_fetch_srv_sess_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
- const struct arg *args, struct sample *smp, const char *kw, void *private)
+smp_fetch_srv_sess_rate(unsigned int opt, const struct arg *args, struct sample *smp,
+ const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT;