From: Thierry FOURNIER Date: Mon, 11 May 2015 13:25:29 +0000 (+0200) Subject: MINOR: sample: fill the struct sample with the options. X-Git-Tag: v1.6-dev2~128 X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw/postgres_fdw.c?a=commitdiff_plain;h=1d33b882d20629aa387305abcc045330e82fc3ae;p=haproxy.git MINOR: sample: fill the struct sample with the options. Options are relative to the sample. Each sample fetched is associated with fetch options or fetch flags. This patch adds the 'opt' vaue in the sample struct. This permits to reduce the sample-fetch function prototype. In other way, the converters will have more detail about the origin of the sample. --- diff --git a/include/types/sample.h b/include/types/sample.h index 07b12f3d9..117b06019 100644 --- a/include/types/sample.h +++ b/include/types/sample.h @@ -252,6 +252,7 @@ struct sample { struct proxy *px; struct session *sess; struct stream *strm; + unsigned int opt; /* fetch options (SMP_OPT_*) */ }; /* Used to store sample constant */ diff --git a/src/hlua.c b/src/hlua.c index d45cac985..262163035 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -2773,6 +2773,7 @@ __LJMP static int hlua_run_sample_fetch(lua_State *L) smp.px = hsmp->p; smp.sess = hsmp->s->sess; smp.strm = hsmp->s; + smp.opt = 0; if (!f->process(0, args, &smp, f->kw, f->private)) { if (hsmp->stringsafe) lua_pushstring(L, ""); @@ -2894,6 +2895,7 @@ __LJMP static int hlua_run_sample_conv(lua_State *L) smp.px = hsmp->p; smp.sess = hsmp->s->sess; smp.strm = hsmp->s; + smp.opt = 0; if (!conv->process(args, &smp, conv->private)) { if (hsmp->stringsafe) lua_pushstring(L, ""); diff --git a/src/sample.c b/src/sample.c index 8cc2234cc..353d6bbc2 100644 --- a/src/sample.c +++ b/src/sample.c @@ -1036,6 +1036,7 @@ struct sample *sample_process(struct proxy *px, struct session *sess, p->px = px; p->sess = sess; p->strm = strm; + p->opt = opt; if (!expr->fetch->process(opt, expr->arg_p, p, expr->fetch->kw, expr->fetch->private)) return NULL;