aboutsummaryrefslogtreecommitdiff
path: root/contrib/bloom/blutils.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2019-11-05 09:17:05 +0900
committerMichael Paquier <michael@paquier.xyz>2019-11-05 09:17:05 +0900
commit3534fa2233285c1fab1e668871aabf05e5541213 (patch)
tree4b6b708590540bee0b2d66b7a485f35df8680809 /contrib/bloom/blutils.c
parent5102f39440f758ea53c2e1cdea7d8411df1805d2 (diff)
downloadpostgresql-3534fa2233285c1fab1e668871aabf05e5541213.tar.gz
postgresql-3534fa2233285c1fab1e668871aabf05e5541213.zip
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 'contrib/bloom/blutils.c')
-rw-r--r--contrib/bloom/blutils.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/contrib/bloom/blutils.c b/contrib/bloom/blutils.c
index 3d44616adcf..e2063bac629 100644
--- a/contrib/bloom/blutils.c
+++ b/contrib/bloom/blutils.c
@@ -475,18 +475,18 @@ BloomInitMetapage(Relation index)
bytea *
bloptions(Datum reloptions, bool validate)
{
- relopt_value *options;
- int numoptions;
BloomOptions *rdopts;
/* Parse the user-given reloptions */
- options = parseRelOptions(reloptions, validate, bl_relopt_kind, &numoptions);
- rdopts = allocateReloptStruct(sizeof(BloomOptions), options, numoptions);
- fillRelOptions((void *) rdopts, sizeof(BloomOptions), options, numoptions,
- validate, bl_relopt_tab, lengthof(bl_relopt_tab));
+ rdopts = (BloomOptions *) build_reloptions(reloptions, validate,
+ bl_relopt_kind,
+ sizeof(BloomOptions),
+ bl_relopt_tab,
+ lengthof(bl_relopt_tab));
/* Convert signature length from # of bits to # to words, rounding up */
- rdopts->bloomLength = (rdopts->bloomLength + SIGNWORDBITS - 1) / SIGNWORDBITS;
+ if (rdopts)
+ rdopts->bloomLength = (rdopts->bloomLength + SIGNWORDBITS - 1) / SIGNWORDBITS;
return (bytea *) rdopts;
}