From 66e2060915368055778438e3cacacee611a4b162 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Tue, 14 Jan 2014 14:09:19 -0600 Subject: [PATCH] wim.c: Remove reopen_wim(), close_wim() --- include/wimlib/wim.h | 3 --- src/wim.c | 21 ++------------------- src/write.c | 5 ++++- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/include/wimlib/wim.h b/include/wimlib/wim.h index 3fdc7d2d..fa19c28d 100644 --- a/include/wimlib/wim.h +++ b/include/wimlib/wim.h @@ -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 diff --git a/src/wim.c b/src/wim.c index b36da84f..f118e793 100644 --- 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; diff --git a/src/write.c b/src/write.c index 63350bfc..1df05c95 100644 --- a/src/write.c +++ b/src/write.c @@ -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 -- 2.43.0