wim.c: Remove reopen_wim(), close_wim()
authorEric Biggers <ebiggers3@gmail.com>
Tue, 14 Jan 2014 20:09:19 +0000 (14:09 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 14 Jan 2014 20:09:19 +0000 (14:09 -0600)
include/wimlib/wim.h
src/wim.c
src/write.c

index 3fdc7d2..fa19c28 100644 (file)
@@ -142,9 +142,6 @@ for_image(WIMStruct *wim, int image, int (*visitor)(WIMStruct *));
 extern int
 wim_checksum_unhashed_streams(WIMStruct *wim);
 
-extern int
-reopen_wim(WIMStruct *wim);
-
 /* Internal open flags (pass to open_wim_as_WIMStruct(), not wimlib_open_wim())
  */
 #define WIMLIB_OPEN_FLAG_FROM_PIPE     0x80000000
index b36da84..f118e79 100644 (file)
--- a/src/wim.c
+++ b/src/wim.c
@@ -534,7 +534,7 @@ wimlib_set_output_pack_chunk_size(WIMStruct *wim, uint32_t chunk_size)
 }
 
 static int
-do_open_wim(const tchar *filename, struct filedes *fd_ret)
+open_wim_file(const tchar *filename, struct filedes *fd_ret)
 {
        int raw_fd;
 
@@ -547,23 +547,6 @@ do_open_wim(const tchar *filename, struct filedes *fd_ret)
        return 0;
 }
 
-int
-reopen_wim(WIMStruct *wim)
-{
-       wimlib_assert(!filedes_valid(&wim->in_fd));
-       return do_open_wim(wim->filename, &wim->in_fd);
-}
-
-int
-close_wim(WIMStruct *wim)
-{
-       if (filedes_valid(&wim->in_fd)) {
-               filedes_close(&wim->in_fd);
-               filedes_invalidate(&wim->in_fd);
-       }
-       return 0;
-}
-
 /*
  * Begins the reading of a WIM file; opens the file and reads its header and
  * lookup table, and optionally checks the integrity.
@@ -582,7 +565,7 @@ begin_read(WIMStruct *wim, const void *wim_filename_or_fd,
                wim->in_fd.is_pipe = 1;
        } else {
                wimfile = wim_filename_or_fd;
-               ret = do_open_wim(wimfile, &wim->in_fd);
+               ret = open_wim_file(wimfile, &wim->in_fd);
                if (ret)
                        return ret;
 
index 63350bf..1df05c9 100644 (file)
@@ -3123,7 +3123,10 @@ overwrite_wim_via_tmpfile(WIMStruct *wim, int write_flags,
                return ret;
        }
 
-       close_wim(wim);
+       if (filedes_valid(&wim->in_fd)) {
+               filedes_close(&wim->in_fd);
+               filedes_invalidate(&wim->in_fd);
+       }
 
        /* Rename the new WIM file to the original WIM file.  Note: on Windows
         * this actually calls win32_rename_replacement(), not _wrename(), so