From 260b93bb72ab31881669cb3e393816a6156c92b7 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 20 Mar 2008 21:01:32 +0000 Subject: [Settings] Add settings hierarchy Add the notion of the settings hierarchy, complete with register/unregister routines. Rename set->store and get->fetch to avoid naming conflicts with get/put as used in reference counting. --- src/hci/commands/config_cmd.c | 4 +--- src/hci/commands/nvo_cmd.c | 5 +++-- src/hci/tui/settings_ui.c | 10 +++++----- 3 files changed, 9 insertions(+), 10 deletions(-) (limited to 'src/hci') diff --git a/src/hci/commands/config_cmd.c b/src/hci/commands/config_cmd.c index 49cc41e75..5a34cea27 100644 --- a/src/hci/commands/config_cmd.c +++ b/src/hci/commands/config_cmd.c @@ -5,7 +5,7 @@ #include static int config_exec ( int argc, char **argv ) { - struct settings *settings; + struct settings *settings = NULL; int rc; if ( argc > 2 ) { @@ -20,8 +20,6 @@ static int config_exec ( int argc, char **argv ) { printf ( "No such scope \"%s\"\n", argv[1] ); return 1; } - } else { - settings = &interactive_settings; } if ( ( rc = settings_ui ( settings ) ) != 0 ) { diff --git a/src/hci/commands/nvo_cmd.c b/src/hci/commands/nvo_cmd.c index 255e97950..e2fdd8fbf 100644 --- a/src/hci/commands/nvo_cmd.c +++ b/src/hci/commands/nvo_cmd.c @@ -16,7 +16,8 @@ static int show_exec ( int argc, char **argv ) { return 1; } - if ( ( rc = get_named_setting ( argv[1], buf, sizeof ( buf ) ) ) < 0 ){ + if ( ( rc = fetch_named_setting ( argv[1], buf, + sizeof ( buf ) ) ) < 0 ){ printf ( "Could not find \"%s\": %s\n", argv[1], strerror ( rc ) ); return 1; @@ -34,7 +35,7 @@ static int set_exec ( int argc, char **argv ) { return 1; } - if ( ( rc = set_named_setting ( argv[1], argv[2] ) ) != 0 ) { + if ( ( rc = store_named_setting ( argv[1], argv[2] ) ) != 0 ) { printf ( "Could not set \"%s\"=\"%s\": %s\n", argv[1], argv[2], strerror ( rc ) ); return 1; diff --git a/src/hci/tui/settings_ui.c b/src/hci/tui/settings_ui.c index a20dd44d1..83146b58e 100644 --- a/src/hci/tui/settings_ui.c +++ b/src/hci/tui/settings_ui.c @@ -114,9 +114,9 @@ static void load_setting ( struct setting_widget *widget ) { widget->editing = 0; /* Read current setting value */ - if ( get_typed_setting ( widget->settings, widget->setting->tag, - widget->setting->type, widget->value, - sizeof ( widget->value ) ) < 0 ) { + if ( fetch_typed_setting ( widget->settings, widget->setting->tag, + widget->setting->type, widget->value, + sizeof ( widget->value ) ) < 0 ) { widget->value[0] = '\0'; } @@ -133,8 +133,8 @@ static void load_setting ( struct setting_widget *widget ) { * @v widget Setting widget */ static int save_setting ( struct setting_widget *widget ) { - return set_typed_setting ( widget->settings, widget->setting->tag, - widget->setting->type, widget->value ); + return store_typed_setting ( widget->settings, widget->setting->tag, + widget->setting->type, widget->value ); } /** -- cgit v1.2.3-55-g7522