diff --git a/expat/doc/reference.html b/expat/doc/reference.html
index 7d1d009d..1cef79bc 100644
--- a/expat/doc/reference.html
+++ b/expat/doc/reference.html
@@ -1703,20 +1703,38 @@ particular parts of the Expat API are available.
-const char **
+const XML_Feature *
XML_GetFeatureList();
+
+enum XML_FeatureEnum {
+ XML_FEATURE_END = 0,
+ XML_FEATURE_UNICODE,
+ XML_FEATURE_UNICODE_WCHAR_T,
+ XML_FEATURE_DTD
+};
+
+typedef struct {
+ enum XML_FeatureEnum feature;
+ XML_Char *name;
+} XML_Feature;
+
-
Returns a list of "feature" identifiers that provide details on how
+
Returns a list of "feature" records, providing details on how
Expat was configured at compile time. Most applications should not
need to worry about this, but this information is otherwise not
available from Expat. This function allows code that does need to
check these features to do so at runtime.
-
The return value is an array of strings, terminated by NULL,
-identifying the feature-test macros Expat was compiled with. Common
-features which may be found in this list include
-"XML_DTD"
and "XML_UNICODE"
.
+
The return value is an array of XML_Feature
,
+terminated by a record with a feature
of
+XML_FEATURE_END
and name
of NULL,
+identifying the feature-test macros Expat was compiled with. Since
+an application that requires this kind of information needs to
+determine the type of character the name
points to,
+records for the XML_UNICODE
and
+XML_UNICODE_WCHAR_T
features will be located at the
+beginning of the list, if they are present at all.
diff --git a/expat/lib/expat.h b/expat/lib/expat.h
index ef0180a8..5a8054e3 100644
--- a/expat/lib/expat.h
+++ b/expat/lib/expat.h
@@ -870,7 +870,21 @@ typedef struct {
XMLPARSEAPI(XML_Expat_Version)
XML_ExpatVersionInfo(void);
-XMLPARSEAPI(const char **)
+/* Added in Expat 1.95.5. */
+enum XML_FeatureEnum {
+ XML_FEATURE_END = 0,
+ XML_FEATURE_UNICODE,
+ XML_FEATURE_UNICODE_WCHAR_T,
+ XML_FEATURE_DTD
+ /* Additional features must be added to the end of this enum. */
+};
+
+typedef struct {
+ enum XML_FeatureEnum feature;
+ XML_Char *name;
+} XML_Feature;
+
+XMLPARSEAPI(const XML_Feature *)
XML_GetFeatureList(void);
diff --git a/expat/lib/xmlparse.c b/expat/lib/xmlparse.c
index 2d6ac3d6..2b4251d3 100644
--- a/expat/lib/xmlparse.c
+++ b/expat/lib/xmlparse.c
@@ -1604,21 +1604,22 @@ XML_ExpatVersionInfo(void)
return version;
}
-const char **
+const XML_Feature *
XML_GetFeatureList(void)
{
- static const char *features[] = {
-#ifdef XML_DTD
- "XML_DTD",
-#endif
+ static const XML_Feature features[] = {
#ifdef XML_UNICODE
- "XML_UNICODE",
+ {XML_FEATURE_UNICODE, XML_L("XML_UNICODE")},
#endif
#ifdef XML_UNICODE_WCHAR_T
- "XML_UNICODE_WCHAR_T",
+ {XML_FEATURE_UNICODE_WCHAR_T, XML_L("XML_UNICODE_WCHAR_T")},
#endif
- NULL
+#ifdef XML_DTD
+ {XML_FEATURE_DTD, XML_L("XML_DTD")},
+#endif
+ {XML_FEATURE_END, NULL}
};
+
return features;
}
diff --git a/expat/xmlwf/xmlwf.c b/expat/xmlwf/xmlwf.c
index 36d8f252..34149c34 100755
--- a/expat/xmlwf/xmlwf.c
+++ b/expat/xmlwf/xmlwf.c
@@ -599,7 +599,7 @@ showVersion(XML_Char *prog)
{
XML_Char *s = prog;
XML_Char ch;
- const char **features = XML_GetFeatureList();
+ const XML_Feature *features = XML_GetFeatureList();
while ((ch = *s) != 0) {
if (ch == '/'
#ifdef WIN32
@@ -610,13 +610,13 @@ showVersion(XML_Char *prog)
++s;
}
ftprintf(stdout, T("%s using %s"), prog, XML_ExpatVersion());
- if (features[0] == NULL)
+ if (features == NULL || features[0].feature == XML_FEATURE_END)
ftprintf(stdout, T("\n"));
else {
int i = 1;
- ftprintf(stdout, T(" (%s"), features[0]);
- while (features[i] != NULL) {
- ftprintf(stdout, T(", %s"), features[i]);
+ ftprintf(stdout, T(" (%s"), features[0].name);
+ while (features[i].feature != XML_FEATURE_END) {
+ ftprintf(stdout, T(", %s"), features[i].name);
++i;
}
ftprintf(stdout, T(")\n"));