X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fdelete_image.c;h=862fb66e53e2efb1f0623aef17ce894d8c746f0f;hp=c95819e980d787ecd0d3996176f5e1688bf9f65a;hb=e8c3ca2d1d0cac3d64985b45a9f654d2029a7518;hpb=13c6ce3160fce7c40008d1d182325c8b42450d1e diff --git a/src/delete_image.c b/src/delete_image.c index c95819e9..862fb66e 100644 --- a/src/delete_image.c +++ b/src/delete_image.c @@ -21,9 +21,16 @@ * along with wimlib; if not, see http://www.gnu.org/licenses/. */ -#include "wimlib_internal.h" -#include "xml.h" -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "wimlib.h" +#include "wimlib/error.h" +#include "wimlib/metadata.h" +#include "wimlib/util.h" +#include "wimlib/wim.h" +#include "wimlib/xml.h" /* * Deletes an image from the WIM. @@ -69,9 +76,8 @@ wimlib_delete_image(WIMStruct *w, int image) put_image_metadata(w->image_metadata[image - 1], w->lookup_table); /* Get rid of the empty slot in the image metadata array. */ - memmove(w->image_metadata[image - 1], - &w->image_metadata[image], - (w->hdr.image_count - image) * sizeof(w->image_metadata[0])); + for (int i = image - 1; i < w->hdr.image_count - 1; i++) + w->image_metadata[i] = w->image_metadata[i + 1]; /* Decrement the image count. */ --w->hdr.image_count;