summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNima Talebi <nima@autonomy.net.au>2009-05-24 03:45:10 +1000
committerNima Talebi <nima@autonomy.net.au>2009-05-24 03:45:10 +1000
commitcf468c3ceaf268da0ba17286bef85e4bdafcbc7e (patch)
treee97e904634bb366e72e5b2445b8efa2af24f59f9 /src
parent6b21c755269a80f3988259157d47430f491448be (diff)
downloadpython-dmidecode-cf468c3ceaf268da0ba17286bef85e4bdafcbc7e.tar.gz
python-dmidecode-cf468c3ceaf268da0ba17286bef85e4bdafcbc7e.tar.xz
python-dmidecode-cf468c3ceaf268da0ba17286bef85e4bdafcbc7e.zip
Loading in the new the new `type' XML file
Diffstat (limited to 'src')
-rw-r--r--src/dmidecodemodule.c11
-rw-r--r--src/dmihelper.h4
2 files changed, 13 insertions, 2 deletions
diff --git a/src/dmidecodemodule.c b/src/dmidecodemodule.c
index 82f2de7..db780f3 100644
--- a/src/dmidecodemodule.c
+++ b/src/dmidecodemodule.c
@@ -61,8 +61,10 @@ static void init(void)
opt.flags = 0;
opt.type = NULL;
opt.mappingxml = NULL;
+ opt.typemappingxml = NULL;
opt.dmiversion_n = NULL;
opt.python_xml_map = strdup(PYTHON_XML_MAP);
+ opt.python_xml_typemap = strdup(PYTHON_XML_TYPEMAP);
}
u8 *parse_opt_type(u8 * p, const char *arg)
@@ -296,7 +298,14 @@ static PyObject *dmidecode_get(PyObject *self, const char *section)
assert( opt.mappingxml != NULL );
}
- mapping = dmiMAP_ParseMappingXML(opt.mappingxml, section);
+ if( opt.typemappingxml == NULL ) {
+ // Load mapping into memory
+ opt.typemappingxml = xmlReadFile(opt.python_xml_typemap, NULL, 0);
+ assert( opt.typemappingxml != NULL );
+ }
+
+
+ mapping = dmiMAP_ParseMappingXML(opt.mappingxml, opt.typemappingxml, section);
if( mapping == NULL ) {
return NULL;
}
diff --git a/src/dmihelper.h b/src/dmihelper.h
index 33da699..57ad7ab 100644
--- a/src/dmihelper.h
+++ b/src/dmihelper.h
@@ -113,9 +113,11 @@ typedef struct _options {
u8 *type;
const struct string_keyword *string;
xmlDoc *mappingxml;
+ xmlDoc *typemappingxml;
+ char *python_xml_map;
+ char *python_xml_typemap;
xmlNode *dmiversion_n;
PyObject *dumpfile;
- char *python_xml_map;
} options;
extern options opt;