X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_xml.c;h=2201ad9bb2e5233ce1ea846d858acc393eb8eec6;hp=532d5ee068883f371ff47dc9a7dd931e8283f974;hb=fe36af6238917000f4cc8b971829e347732df598;hpb=d9557a9bea506fd8b40acd7a44a16b46e2a97848 diff --git a/palacios/src/palacios/vmm_xml.c b/palacios/src/palacios/vmm_xml.c index 532d5ee..2201ad9 100644 --- a/palacios/src/palacios/vmm_xml.c +++ b/palacios/src/palacios/vmm_xml.c @@ -569,7 +569,7 @@ static void v3_xml_open_tag(struct v3_xml_root * root, char * name, char ** attr // parse the given xml string and return an v3_xml structure -struct v3_xml * v3_xml_parse_str(char * buf, size_t len) { +static struct v3_xml * parse_str(char * buf, size_t len) { struct v3_xml_root * root = (struct v3_xml_root *)v3_xml_new(NULL); char quote_char; char last_char; @@ -825,7 +825,20 @@ struct v3_xml * v3_xml_parse_str(char * buf, size_t len) { } +struct v3_xml * v3_xml_parse(char * buf) { + int str_len = 0; + char * xml_buf = NULL; + if (!buf) { + return NULL; + } + + str_len = strlen(buf); + xml_buf = (char *)V3_Malloc(str_len + 1); + strcpy(xml_buf, buf); + + return parse_str(xml_buf, str_len); +} @@ -852,7 +865,7 @@ void v3_xml_free(struct v3_xml * xml) { } } - V3_Free(root->ent); // free list of general entities + V3_Free(root->ent); // free list of general entities for (i = 0; (a = root->attr[i]); i++) { for (j = 1; a[j++]; j += 2) { @@ -870,7 +883,6 @@ void v3_xml_free(struct v3_xml * xml) { } V3_Free(root->str_ptr); // malloced xml data - } v3_xml_free_attr(xml->attr); // tag attributes