[util] Minor
This commit is contained in:
parent
64e41d2c89
commit
83a612739a
@ -758,10 +758,7 @@ text_options_t::get_line (unsigned int *len)
|
|||||||
fail (true, "At least one of text or text-file must be set");
|
fail (true, "At least one of text or text-file must be set");
|
||||||
|
|
||||||
if (0 != strcmp (text_file, "-"))
|
if (0 != strcmp (text_file, "-"))
|
||||||
{
|
|
||||||
fp = fopen (text_file, "r");
|
fp = fopen (text_file, "r");
|
||||||
close_fp = true;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
fp = stdin;
|
fp = stdin;
|
||||||
|
|
||||||
@ -798,10 +795,7 @@ output_options_t::get_file_handle (void)
|
|||||||
return fp;
|
return fp;
|
||||||
|
|
||||||
if (output_file)
|
if (output_file)
|
||||||
{
|
|
||||||
fp = fopen (output_file, "wb");
|
fp = fopen (output_file, "wb");
|
||||||
close_fp = true;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||||
setmode (fileno (stdout), O_BINARY);
|
setmode (fileno (stdout), O_BINARY);
|
||||||
|
@ -510,7 +510,6 @@ struct text_options_t : option_group_t
|
|||||||
text_file = nullptr;
|
text_file = nullptr;
|
||||||
|
|
||||||
fp = nullptr;
|
fp = nullptr;
|
||||||
close_fp = false;
|
|
||||||
gs = nullptr;
|
gs = nullptr;
|
||||||
line = nullptr;
|
line = nullptr;
|
||||||
line_len = (unsigned int) -1;
|
line_len = (unsigned int) -1;
|
||||||
@ -525,7 +524,7 @@ struct text_options_t : option_group_t
|
|||||||
g_free (text_file);
|
g_free (text_file);
|
||||||
if (gs)
|
if (gs)
|
||||||
g_string_free (gs, true);
|
g_string_free (gs, true);
|
||||||
if (close_fp)
|
if (fp && fp != stdin)
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,7 +547,6 @@ struct text_options_t : option_group_t
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
bool close_fp;
|
|
||||||
GString *gs;
|
GString *gs;
|
||||||
char *line;
|
char *line;
|
||||||
unsigned int line_len;
|
unsigned int line_len;
|
||||||
@ -565,7 +563,6 @@ struct output_options_t : option_group_t
|
|||||||
explicit_output_format = false;
|
explicit_output_format = false;
|
||||||
|
|
||||||
fp = nullptr;
|
fp = nullptr;
|
||||||
close_fp = false;
|
|
||||||
|
|
||||||
add_options (parser);
|
add_options (parser);
|
||||||
}
|
}
|
||||||
@ -573,7 +570,7 @@ struct output_options_t : option_group_t
|
|||||||
{
|
{
|
||||||
g_free (output_file);
|
g_free (output_file);
|
||||||
g_free (output_format);
|
g_free (output_format);
|
||||||
if (close_fp)
|
if (fp && fp != stdout)
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -605,7 +602,6 @@ struct output_options_t : option_group_t
|
|||||||
bool explicit_output_format;
|
bool explicit_output_format;
|
||||||
|
|
||||||
mutable FILE *fp;
|
mutable FILE *fp;
|
||||||
bool close_fp;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct format_options_t : option_group_t
|
struct format_options_t : option_group_t
|
||||||
|
Loading…
Reference in New Issue
Block a user