aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2019-11-14 13:59:59 +0900
committerMichael Paquier <michael@paquier.xyz>2019-11-14 13:59:59 +0900
commit50d22de9325f41a32faeb0d1055f50b43d0507b3 (patch)
treeb76bf8c32d49d3e95787bb6733476a35ab48d5ec /src/backend/access
parent1bbd608fdae7af314d8e2229e369a45a3da83cd8 (diff)
downloadpostgresql-50d22de9325f41a32faeb0d1055f50b43d0507b3.tar.gz
postgresql-50d22de9325f41a32faeb0d1055f50b43d0507b3.zip
Cleanup code in reloptions.h regarding reloption handling
reloptions.h includes since ba748f7 a set of macros to handle reloption types in a way similar to how parseRelOptions() works. They have never been used in the core code, and we have more simple methods now to parse and fill in rd_options for a given relation depending on its relkind, so remove this interface to simplify things. Per discussion between Amit Langote, Álvaro Herrera and me. Discussion: https://postgr.es/m/CA+HiwqE6zbNO92az6pp5GiTw4tr-9rfCE0t84whQSP+YwSKjMQ@mail.gmail.com
Diffstat (limited to 'src/backend/access')
-rw-r--r--src/backend/access/common/reloptions.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index feb105e1ba1..3f22a6c354f 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -497,6 +497,15 @@ static void parse_one_reloption(relopt_value *option, char *text_str,
int text_len, bool validate);
/*
+ * Get the length of a string reloption (either default or the user-defined
+ * value). This is used for allocation purposes when building a set of
+ * relation options.
+ */
+#define GET_STRING_RELOPTION_LEN(option) \
+ ((option).isset ? strlen((option).values.string_val) : \
+ ((relopt_string *) (option).gen)->default_len)
+
+/*
* initialize_reloptions
* initialization routine, must be called before parsing
*
@@ -1142,7 +1151,7 @@ extractRelOptions(HeapTuple tuple, TupleDesc tupdesc,
* returned array. Values of type string are allocated separately and must
* be freed by the caller.
*/
-relopt_value *
+static relopt_value *
parseRelOptions(Datum options, bool validate, relopt_kind kind,
int *numrelopts)
{
@@ -1367,7 +1376,7 @@ parse_one_reloption(relopt_value *option, char *text_str, int text_len,
* "base" should be sizeof(struct) of the reloptions struct (StdRdOptions or
* equivalent).
*/
-void *
+static void *
allocateReloptStruct(Size base, relopt_value *options, int numoptions)
{
Size size = base;
@@ -1391,7 +1400,7 @@ allocateReloptStruct(Size base, relopt_value *options, int numoptions)
* elems, of length numelems, is the table describing the allowed options.
* When validate is true, it is expected that all options appear in elems.
*/
-void
+static void
fillRelOptions(void *rdopts, Size basesize,
relopt_value *options, int numoptions,
bool validate,