1
0
Fork 0
mirror of https://git.tukaani.org/xz.git synced 2024-04-04 12:36:23 +02:00

xz: Refactor to remove is_empty_filename().

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.
This commit is contained in:
Lasse Collin 2022-10-25 18:30:55 +03:00
parent 8562401597
commit 8b46ae8cde
3 changed files with 3 additions and 17 deletions

View file

@ -748,8 +748,10 @@ error:
extern file_pair * extern file_pair *
io_open_src(const char *src_name) 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; return NULL;
}
// Since we have only one file open at a time, we can use // Since we have only one file open at a time, we can use
// a statically allocated structure. // a statically allocated structure.

View 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 extern bool
is_tty_stdin(void) is_tty_stdin(void)
{ {

View file

@ -105,10 +105,6 @@ extern void my_snprintf(char **pos, size_t *left, const char *fmt, ...)
lzma_attribute((__format__(__printf__, 3, 4))); 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 /// \brief Test if stdin is a terminal
/// ///
/// If stdin is a terminal, an error message is printed and exit status set /// If stdin is a terminal, an error message is printed and exit status set