[tables] Incorporate table data type information into table definition

Eliminate the potential for mismatches between table names and the
table entry data type by incorporating the data type into the
definition of the table, rather than specifying it explicitly in each
table accessor method.
This commit is contained in:
Michael Brown
2009-03-13 00:13:38 +00:00
parent 1266d7902b
commit 3c68ff99ea
26 changed files with 185 additions and 130 deletions

View File

@@ -78,7 +78,7 @@ struct setting_widget {
};
/** Number of registered configuration settings */
#define NUM_SETTINGS table_num_entries ( struct setting, SETTINGS )
#define NUM_SETTINGS table_num_entries ( SETTINGS )
static void load_setting ( struct setting_widget *widget ) __nonnull;
static int save_setting ( struct setting_widget *widget ) __nonnull;
@@ -219,8 +219,7 @@ static int edit_setting ( struct setting_widget *widget, int key ) {
static void init_setting_index ( struct setting_widget *widget,
struct settings *settings,
unsigned int index ) {
struct setting *all_settings =
table_start ( struct setting, SETTINGS );
struct setting *all_settings = table_start ( SETTINGS );
init_setting ( widget, settings, &all_settings[index],
( SETTINGS_LIST_ROW + index ), SETTINGS_LIST_COL );