summaryrefslogtreecommitdiff
path: root/src/test/modules
diff options
context:
space:
mode:
authorMichael Paquier2019-11-05 00:17:05 +0000
committerMichael Paquier2019-11-05 00:17:05 +0000
commit3534fa2233285c1fab1e668871aabf05e5541213 (patch)
tree4b6b708590540bee0b2d66b7a485f35df8680809 /src/test/modules
parent5102f39440f758ea53c2e1cdea7d8411df1805d2 (diff)
Refactor code building relation options
Historically, the code to build relation options has been shaped the same way in multiple code paths by using a set of datums in input with the options parsed with a static table which is then filled with the option values. This introduces a new common routine in reloptions.c to do most of the legwork for the in-core code paths. Author: Amit Langote Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/CA+HiwqGsoSn_uTPPYT19WrtR7oYpYtv4CdS0xuedTKiHHWuk_g@mail.gmail.com
Diffstat (limited to 'src/test/modules')
-rw-r--r--src/test/modules/dummy_index_am/dummy_index_am.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/test/modules/dummy_index_am/dummy_index_am.c b/src/test/modules/dummy_index_am/dummy_index_am.c
index bc68767f3a0..053636e4b49 100644
--- a/src/test/modules/dummy_index_am/dummy_index_am.c
+++ b/src/test/modules/dummy_index_am/dummy_index_am.c
@@ -222,17 +222,10 @@ dicostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
static bytea *
dioptions(Datum reloptions, bool validate)
{
- relopt_value *options;
- int numoptions;
- DummyIndexOptions *rdopts;
-
- /* Parse the user-given reloptions */
- options = parseRelOptions(reloptions, validate, di_relopt_kind, &numoptions);
- rdopts = allocateReloptStruct(sizeof(DummyIndexOptions), options, numoptions);
- fillRelOptions((void *) rdopts, sizeof(DummyIndexOptions), options, numoptions,
- validate, di_relopt_tab, lengthof(di_relopt_tab));
-
- return (bytea *) rdopts;
+ return (bytea *) build_reloptions(reloptions, validate,
+ di_relopt_kind,
+ sizeof(DummyIndexOptions),
+ di_relopt_tab, lengthof(di_relopt_tab));
}
/*