]> wimlib.net Git - wimlib/blobdiff - src/delete_image.c
WIMStruct: Rename 'deletion_occurred' to 'image_deletion_occurred'
[wimlib] / src / delete_image.c
index 2ad5a27a8f0d4e95962968dc90852e6e5631f190..533d62cb502675dfaf0a94ec8c8d3b3d6456ff1d 100644 (file)
@@ -5,20 +5,18 @@
 /*
  * Copyright (C) 2012, 2013 Eric Biggers
  *
- * This file is part of wimlib, a library for working with WIM files.
+ * This file is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at your option) any
+ * later version.
  *
- * wimlib is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 3 of the License, or (at your option)
- * any later version.
- *
- * wimlib is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- * A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * This file is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  * details.
  *
- * You should have received a copy of the GNU General Public License
- * along with wimlib; if not, see http://www.gnu.org/licenses/.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this file; if not, see http://www.gnu.org/licenses/.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -39,10 +37,6 @@ wimlib_delete_image(WIMStruct *wim, int image)
        int ret;
        int first, last;
 
-       ret = can_delete_from_wim(wim);
-       if (ret)
-               return ret;
-
        if (image == WIMLIB_ALL_IMAGES) {
                last = wim->hdr.image_count;
                first = 1;
@@ -54,16 +48,16 @@ wimlib_delete_image(WIMStruct *wim, int image)
        for (image = last; image >= first; image--) {
                DEBUG("Deleting image %d", image);
 
-               /* Even if the dentry tree is not allocated, we must select it (and
-                * therefore allocate it) so that we can decrement the reference counts
-                * in the lookup table.  */
+               /* Even if the dentry tree is not allocated, we must select it
+                * (and therefore allocate it) so that we can decrement stream
+                * reference counts.  */
                ret = select_wim_image(wim, image);
                if (ret)
                        return ret;
 
-               /* Unless the image metadata is shared by another WIMStruct, free the
-                * dentry tree, any lookup table entries that have their refcnt
-                * decremented to 0, and the security data. */
+               /* Unless the image metadata is shared by another WIMStruct,
+                * free the dentry tree, free the security data, and decrement
+                * stream reference counts.  */
                put_image_metadata(wim->image_metadata[image - 1], wim->lookup_table);
 
                /* Get rid of the empty slot in the image metadata array. */
@@ -84,7 +78,7 @@ wimlib_delete_image(WIMStruct *wim, int image)
                /* Remove the image from the XML information. */
                xml_delete_image(&wim->wim_info, image);
 
-               wim->deletion_occurred = 1;
+               wim->image_deletion_occurred = 1;
        }
        return 0;
 }