> > + if (virFileReadAll(from, VIRSH_MAX_XML_FILE, &buffer) < 0) > > + return FALSE; > > + > > + p = buffer; > > + while ((p = strstr(p, "<cpu>"))) { > > + list = vshRealloc(ctl, list, sizeof(char *) * (count + 1)); > > + list[count++] = p; > > + > > + if ((p = strstr(p, "</cpu>"))) { > > + p += strlen("</cpu>"); > > + if (*p != '\0') { > > + *p = '\0'; > > + p++; > > + } > > + } > > + } > > Aye aye aye ... I understand what you're trying to do but I think > this is a bit weird ... I think we should be able to come with an > alternative, cleaner based on parsing the content as an XML well > balanced fragment and then reserialize all cpu elements found. > Your scheme would explode for example if we tried to add a <cpu> > element as one possible child of <cpu> or if we added attributes to > <cpu>, it's too fragile. I can think the other parts can be commited > independantly anyway. Yeah, it's ugly but I wanted to avoid the complexity of parsing XML and formating back to a string. And I still don't think it is a good idea. Maybe I could extend virsh to support variable number of arguments and take each CPU definition from its own file. Jirka -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list