History

msg: change hack to silence command line pre-parse error messages

mp_msg_levels[] will go away.

wm4 committed 12 years ago

Commit 591a6721 parent 78292053 files · +6 −6Browse files

Unified · Split

3 files
  1. common/msg.c +3 −0
  2. common/msg.h +1 −1
  3. options/parse_commandline.c +2 −5
common/msg.c+3−0
@@ -59,6 +59,7 @@ static struct mp_log *legacy_logs[MSGT_MAX]; · 58 unmodified lines
5959 int mp_msg_levels[MSGT_MAX]; // verbose level of this module. initialized to -2
6060 int mp_msg_level_all = MSGL_STATUS;
6161 int verbose = 0;
62+bool mp_msg_mute;
6263 int mp_msg_color = 1;
6364 int mp_msg_module = 0;
6465 int mp_msg_cancolor = 0;
@@ -79,6 +80,8 @@ static void mp_msg_do_init(void){ · 14 unmodified lines
7980
8081 int mp_msg_test(int mod, int lev)
8182 {
83+ if (mp_msg_mute)
84+ return false;
8285 if (lev == MSGL_STATUS) {
8386 // skip status line output if stderr is a tty but in background
8487 if (terminal_in_background())
common/msg.h+1−1
@@ -28,8 +28,8 @@ · 27 unmodified lines
2828
2929 struct mp_log;
3030
31−// defined in mplayer.c
3231 extern int verbose;
32+extern bool mp_msg_mute;
3333
3434 // verbosity elevel:
3535
options/parse_commandline.c+2−5
@@ -265,8 +265,6 @@ err_out: · 264 unmodified lines
265265 return ret;
266266 }
267267
268−extern int mp_msg_levels[];
269−
270268 /* Parse some command line options early before main parsing.
271269 * --no-config prevents reading configuration files (otherwise done before
272270 * command line parsing), and --really-quiet suppresses messages printed
@@ -275,8 +273,7 @@ extern int mp_msg_levels[]; · 2 unmodified lines
275273 void m_config_preparse_command_line(m_config_t *config, int argc, char **argv)
276274 {
277275 // Hack to shut up parser error messages
278− int msg_lvl_backup = mp_msg_levels[MSGT_CFGPARSER];
279− mp_msg_levels[MSGT_CFGPARSER] = -11;
276+ mp_msg_mute = true;
280277
281278 struct parse_state p = {config, argc, argv};
282279 while (split_opt_silent(&p) == 0) {
@@ -290,5 +287,5 @@ void m_config_preparse_command_line(m_config_t *config, int argc, char **argv) · 7 unmodified lines
290287 }
291288 }
292289
293− mp_msg_levels[MSGT_CFGPARSER] = msg_lvl_backup;
290+ mp_msg_mute = false;
294291 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t