*/
/*
- * Copyright (C) 2012 Eric Biggers
+ * Copyright (C) 2012, 2013 Eric Biggers
*
* This file is part of wimlib, a library for working with WIM files.
*
destroy_image_info(&wim_info->images[image - 1]);
- memcpy(&wim_info->images[image - 1],
- &wim_info->images[image],
- (wim_info->num_images - image) * sizeof(struct image_info));
+ memmove(&wim_info->images[image - 1],
+ &wim_info->images[image],
+ (wim_info->num_images - image) * sizeof(struct image_info));
if (--wim_info->num_images == 0) {
free_wim_info(wim_info);
putchar('\n');
}
+void libxml_global_init()
+{
+ xmlInitParser();
+}
+
+void libxml_global_cleanup()
+{
+ xmlCleanupParser();
+}
+
/*
* Reads the XML data from a WIM file.
*/
if (resource_is_compressed(res_entry)) {
ERROR("XML data is supposed to be uncompressed");
ret = WIMLIB_ERR_XML;
- goto out_cleanup_parser;
+ goto out;
}
if (res_entry->size < 2) {
ERROR("XML data must be at least 2 bytes long");
ret = WIMLIB_ERR_XML;
- goto out_cleanup_parser;
+ goto out;
}
xml_data = MALLOC(res_entry->size + 2);
if (!xml_data) {
ret = WIMLIB_ERR_NOMEM;
- goto out_cleanup_parser;
+ goto out;
}
ret = read_uncompressed_resource(fp, res_entry->offset,
if (ret != 0)
goto out_free_doc;
- DEBUG("Freeing XML tree.");
-
*xml_data_ret = xml_data;
xml_data = NULL;
out_free_doc:
+ DEBUG("Freeing XML tree.");
xmlFreeDoc(doc);
out_free_xml_data:
FREE(xml_data);
-out_cleanup_parser:
- xmlCleanupParser();
+out:
return ret;
}