summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Hagander2008-04-04 08:33:15 +0000
committerMagnus Hagander2008-04-04 08:33:15 +0000
commitf79068d7675cb6658e42cbdbcf5950afc8da0132 (patch)
treeffe76a762381f9f4c2c8e48286dc7ebb5ae619fc
parent181831c160bf402aa8d66f333bc2507a54c82ec4 (diff)
Turn xmlbinary and xmloption GUC variables into enumsTurn xmlbinary and
xmloption GUC variables into enums..
-rw-r--r--src/backend/utils/adt/xml.c4
-rw-r--r--src/backend/utils/misc/guc.c89
-rw-r--r--src/include/utils/xml.h4
3 files changed, 34 insertions, 63 deletions
diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c
index 9d8186dc84..a3f588bd79 100644
--- a/src/backend/utils/adt/xml.c
+++ b/src/backend/utils/adt/xml.c
@@ -86,8 +86,8 @@
/* GUC variables */
-XmlBinaryType xmlbinary;
-XmlOptionType xmloption;
+int xmlbinary;
+int xmloption;
#ifdef USE_LIBXML
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index cb545e6896..83a2fbdb0c 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -155,8 +155,6 @@ static bool assign_transaction_read_only(bool newval, bool doit, GucSource sourc
static const char *assign_canonical_path(const char *newval, bool doit, GucSource source);
static const char *assign_backslash_quote(const char *newval, bool doit, GucSource source);
static const char *assign_timezone_abbreviations(const char *newval, bool doit, GucSource source);
-static const char *assign_xmlbinary(const char *newval, bool doit, GucSource source);
-static const char *assign_xmloption(const char *newval, bool doit, GucSource source);
static const char *show_archive_command(void);
static bool assign_tcp_keepalives_idle(int newval, bool doit, GucSource source);
static bool assign_tcp_keepalives_interval(int newval, bool doit, GucSource source);
@@ -243,6 +241,17 @@ static const struct config_enum_entry syslog_facility_options[] = {
};
#endif
+static const struct config_enum_entry xmlbinary_options[] = {
+ {"base64", XMLBINARY_BASE64},
+ {"hex", XMLBINARY_HEX},
+ {NULL, 0}
+};
+
+static const struct config_enum_entry xmloption_options[] = {
+ {"content", XMLOPTION_CONTENT},
+ {"document", XMLOPTION_DOCUMENT},
+ {NULL, 0}
+};
/*
* GUC option variables that are exported from this module
@@ -316,8 +325,6 @@ static char *timezone_abbreviations_string;
static char *XactIsoLevel_string;
static char *data_directory;
static char *custom_variable_classes;
-static char *xmlbinary_string;
-static char *xmloption_string;
static int max_function_args;
static int max_index_keys;
static int max_identifier_length;
@@ -2383,25 +2390,6 @@ static struct config_string ConfigureNamesString[] =
},
{
- {"xmlbinary", PGC_USERSET, CLIENT_CONN_STATEMENT,
- gettext_noop("Sets how binary values are to be encoded in XML."),
- gettext_noop("Valid values are BASE64 and HEX.")
- },
- &xmlbinary_string,
- "base64", assign_xmlbinary, NULL
- },
-
- {
- {"xmloption", PGC_USERSET, CLIENT_CONN_STATEMENT,
- gettext_noop("Sets whether XML data in implicit parsing and serialization "
- "operations is to be considered as documents or content fragments."),
- gettext_noop("Valid values are DOCUMENT and CONTENT.")
- },
- &xmloption_string,
- "content", assign_xmloption, NULL
- },
-
- {
{"default_text_search_config", PGC_USERSET, CLIENT_CONN_LOCALE,
gettext_noop("Sets default text search configuration."),
NULL
@@ -2524,6 +2512,25 @@ static struct config_enum ConfigureNamesEnum[] =
assign_session_replication_role, NULL
},
+ {
+ {"xmlbinary", PGC_USERSET, CLIENT_CONN_STATEMENT,
+ gettext_noop("Sets how binary values are to be encoded in XML."),
+ gettext_noop("Valid values are BASE64 and HEX.")
+ },
+ &xmlbinary,
+ XMLBINARY_BASE64, xmlbinary_options, NULL, NULL
+ },
+
+ {
+ {"xmloption", PGC_USERSET, CLIENT_CONN_STATEMENT,
+ gettext_noop("Sets whether XML data in implicit parsing and serialization "
+ "operations is to be considered as documents or content fragments."),
+ gettext_noop("Valid values are DOCUMENT and CONTENT.")
+ },
+ &xmloption,
+ XMLOPTION_CONTENT, xmloption_options, NULL, NULL
+ },
+
/* End-of-list marker */
{
@@ -7173,42 +7180,6 @@ pg_timezone_abbrev_initialize(void)
}
static const char *
-assign_xmlbinary(const char *newval, bool doit, GucSource source)
-{
- XmlBinaryType xb;
-
- if (pg_strcasecmp(newval, "base64") == 0)
- xb = XMLBINARY_BASE64;
- else if (pg_strcasecmp(newval, "hex") == 0)
- xb = XMLBINARY_HEX;
- else
- return NULL; /* reject */
-
- if (doit)
- xmlbinary = xb;
-
- return newval;
-}
-
-static const char *
-assign_xmloption(const char *newval, bool doit, GucSource source)
-{
- XmlOptionType xo;
-
- if (pg_strcasecmp(newval, "document") == 0)
- xo = XMLOPTION_DOCUMENT;
- else if (pg_strcasecmp(newval, "content") == 0)
- xo = XMLOPTION_CONTENT;
- else
- return NULL; /* reject */
-
- if (doit)
- xmloption = xo;
-
- return newval;
-}
-
-static const char *
show_archive_command(void)
{
if (XLogArchiveMode)
diff --git a/src/include/utils/xml.h b/src/include/utils/xml.h
index 2c9e687872..3989271a5a 100644
--- a/src/include/utils/xml.h
+++ b/src/include/utils/xml.h
@@ -83,8 +83,8 @@ typedef enum
XMLBINARY_HEX
} XmlBinaryType;
-extern XmlBinaryType xmlbinary;
+extern int xmlbinary; /* XmlBinaryType, but int for guc enum */
-extern XmlOptionType xmloption;
+extern int xmloption; /* XmlOptionType, but int for guc enum */
#endif /* XML_H */