From: Ray Strode Date: Wed, 27 Nov 2013 05:07:54 +0000 (-0500) Subject: main: drop parameters for check_for_consoles function X-Git-Tag: 0.9.0~65^2~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63e9b4faee93a4f4ff4e504e5a4f1148c095d8b6;p=thirdparty%2Fplymouth.git main: drop parameters for check_for_consoles function both the default tty and whether or not displays should be added are available in the global state object (as state->default_tty and state->is_shown respectively), so they don't need to be parameters. The latter one was a boolean, so having it as a parameter was confusing at the call sites. This commit drops the parameters. --- diff --git a/src/main.c b/src/main.c index 9c450c0c..17dd23a3 100644 --- a/src/main.c +++ b/src/main.c @@ -146,9 +146,7 @@ static void on_error_message (ply_buffer_t *debug_buffer, static ply_buffer_t *debug_buffer; static char *debug_buffer_path = NULL; static char *pid_file = NULL; -static void check_for_consoles (state_t *state, - const char *default_tty, - bool should_add_displays); +static void check_for_consoles (state_t *state); static void toggle_between_splash_and_details (state_t *state); #ifdef PLY_ENABLE_SYSTEMD_INTEGRATION static void tell_systemd_to_print_details (state_t *state); @@ -891,7 +889,7 @@ on_show_splash (state_t *state) state->is_shown = true; - check_for_consoles (state, state->default_tty, true); + check_for_consoles (state); has_display = ply_list_get_length (state->pixel_displays) > 0 || ply_list_get_length (state->text_displays) > 0; @@ -2115,9 +2113,7 @@ add_consoles_from_kernel_command_line (state_t *state, } static void -check_for_consoles (state_t *state, - const char *default_tty, - bool should_add_displays) +check_for_consoles (state_t *state) { char *console; ply_hashtable_t *consoles; @@ -2125,7 +2121,7 @@ check_for_consoles (state_t *state, bool ignore_serial_consoles; ply_trace ("checking for consoles%s", - should_add_displays? " and adding displays": ""); + state->is_shown? " and adding displays": ""); consoles = ply_hashtable_new (ply_hashtable_string_hash, ply_hashtable_string_compare); @@ -2152,7 +2148,7 @@ check_for_consoles (state_t *state, if (console != NULL) { free (console); - console = strdup (default_tty); + console = strdup (state->default_tty); ply_hashtable_insert (consoles, console, console); } @@ -2160,7 +2156,7 @@ check_for_consoles (state_t *state, if (console != NULL) { free (console); - console = strdup (default_tty); + console = strdup (state->default_tty); ply_hashtable_insert (consoles, console, console); } @@ -2170,14 +2166,14 @@ check_for_consoles (state_t *state, if (console != NULL) state->kernel_console_tty = strdup (console); - if (should_add_displays) + if (state->is_shown) { /* Do a full graphical splash if there's no weird serial console * stuff going on, otherwise just prepare text splashes */ if ((num_consoles == 0) || ((num_consoles == 1) && - (ply_hashtable_lookup (consoles, (void *) default_tty) != NULL))) + (ply_hashtable_lookup (consoles, (void *) state->default_tty) != NULL))) add_default_displays_and_keyboard (state); else ply_hashtable_foreach (consoles, @@ -2279,8 +2275,7 @@ initialize_environment (state_t *state) state->messages = ply_list_new (); state->keyboard = NULL; - - check_for_consoles (state, state->default_tty, false); + check_for_consoles (state); redirect_standard_io_to_dev_null ();