diff options
author | David Sommerseth <davids@redhat.com> | 2009-04-10 13:38:52 +0200 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2009-04-29 11:22:11 +0200 |
commit | b8bcbc709a3bdb5ee1e59e22d5e54c59f391165f (patch) | |
tree | fd859afdbbdd1578487f4a97d43c5d9d6c37a55a | |
parent | 92ea3b07784853558d93391dbc364c69463cd61d (diff) | |
download | python-dmidecode-b8bcbc709a3bdb5ee1e59e22d5e54c59f391165f.tar.gz python-dmidecode-b8bcbc709a3bdb5ee1e59e22d5e54c59f391165f.tar.xz python-dmidecode-b8bcbc709a3bdb5ee1e59e22d5e54c59f391165f.zip |
Added right trim of xml data
-rw-r--r-- | src/dmixml.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/dmixml.c b/src/dmixml.c index 0feb90c..08c5259 100644 --- a/src/dmixml.c +++ b/src/dmixml.c @@ -33,6 +33,7 @@ // Internal function for dmixml_* functions ... builds up a variable xmlChar* string xmlChar *dmixml_buildstr(size_t len, const char *fmt, va_list ap) { xmlChar *ret = NULL, *xmlfmt = NULL; + xmlChar *ptr = NULL; ret = (xmlChar *) malloc(len+2); assert( ret != NULL ); @@ -44,6 +45,12 @@ xmlChar *dmixml_buildstr(size_t len, const char *fmt, va_list ap) { xmlStrVPrintf(ret, len, xmlfmt, ap); free(xmlfmt); + // Right trim the string + ptr = ret + xmlStrlen(ret)-1; + while( (ptr >= ret) && (*ptr == ' ') ) { + *ptr = 0; + ptr--; + } return ret; } |