]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
xz: Refactor to remove is_empty_filename().
authorLasse Collin <lasse.collin@tukaani.org>
Tue, 25 Oct 2022 15:30:55 +0000 (18:30 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Tue, 25 Oct 2022 15:30:55 +0000 (18:30 +0300)
Long ago it was used in list.c too but nowadays it's needed
only in io_open_src() so it's nicer to avoid a separate function.

src/xz/file_io.c
src/xz/util.c
src/xz/util.h

index b559ae3503d7d14c7fe9d3d469d6ff015327eeb9..046ca7e3c3e8fbce4b174728212cb2a013977f97 100644 (file)
@@ -748,8 +748,10 @@ error:
 extern file_pair *
 io_open_src(const char *src_name)
 {
-       if (is_empty_filename(src_name))
+       if (src_name[0] == '\0') {
+               message_error(_("Empty filename, skipping"));
                return NULL;
+       }
 
        // Since we have only one file open at a time, we can use
        // a statically allocated structure.
index a1339f4fdf3cf09f558a6af0b533db4fd3b65355..9f9a8fb024e4afaeb7f027bb5d756ad535ce458d 100644 (file)
@@ -260,18 +260,6 @@ my_snprintf(char **pos, size_t *left, const char *fmt, ...)
 }
 
 
-extern bool
-is_empty_filename(const char *filename)
-{
-       if (filename[0] == '\0') {
-               message_error(_("Empty filename, skipping"));
-               return true;
-       }
-
-       return false;
-}
-
-
 extern bool
 is_tty_stdin(void)
 {
index a2516bf968038df38ef98915f8b00d075aed15fd..4a536f52ea4e3e2b7738c48f96d3b21ff82b4f83 100644 (file)
@@ -105,10 +105,6 @@ extern void my_snprintf(char **pos, size_t *left, const char *fmt, ...)
                lzma_attribute((__format__(__printf__, 3, 4)));
 
 
-/// \brief      Check if filename is empty and print an error message
-extern bool is_empty_filename(const char *filename);
-
-
 /// \brief      Test if stdin is a terminal
 ///
 /// If stdin is a terminal, an error message is printed and exit status set