Use FOR_LIST_ELEMENTS convenience macros

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-03-26 19:32:21 +01:00
parent 42ca71ca47
commit 3f8ae91c09
5 changed files with 8 additions and 8 deletions

View file

@ -115,7 +115,7 @@ grub_command_execute (const char *name, int argc, char **argv)
return (cmd) ? cmd->func (cmd, argc, argv) : GRUB_ERR_FILE_NOT_FOUND; return (cmd) ? cmd->func (cmd, argc, argv) : GRUB_ERR_FILE_NOT_FOUND;
} }
#define FOR_COMMANDS(var) for ((var) = grub_command_list; (var); (var) = (var)->next) #define FOR_COMMANDS(var) FOR_LIST_ELEMENTS((var), grub_command_list)
void grub_register_core_commands (void); void grub_register_core_commands (void);

View file

@ -91,7 +91,7 @@ grub_partition_map_unregister (grub_partition_map_t partmap)
GRUB_AS_LIST (partmap)); GRUB_AS_LIST (partmap));
} }
#define FOR_PARTITION_MAPS(var) for (var = grub_partition_map_list; var; var = var->next) #define FOR_PARTITION_MAPS(var) FOR_LIST_ELEMENTS((var), (grub_partition_map_list))
static inline grub_disk_addr_t static inline grub_disk_addr_t

View file

@ -245,10 +245,10 @@ grub_term_unregister_output (grub_term_output_t term)
GRUB_AS_LIST (term)); GRUB_AS_LIST (term));
} }
#define FOR_ACTIVE_TERM_INPUTS(var) for (var = grub_term_inputs; var; var = var->next) #define FOR_ACTIVE_TERM_INPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_inputs))
#define FOR_DISABLED_TERM_INPUTS(var) for (var = grub_term_inputs_disabled; var; var = var->next) #define FOR_DISABLED_TERM_INPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_inputs_disabled))
#define FOR_ACTIVE_TERM_OUTPUTS(var) for (var = grub_term_outputs; var; var = var->next) #define FOR_ACTIVE_TERM_OUTPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_outputs))
#define FOR_DISABLED_TERM_OUTPUTS(var) for (var = grub_term_outputs_disabled; var; var = var->next) #define FOR_DISABLED_TERM_OUTPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_outputs_disabled))
void EXPORT_FUNC(grub_putchar) (int c); void EXPORT_FUNC(grub_putchar) (int c);
void EXPORT_FUNC(grub_putcode) (grub_uint32_t code, void EXPORT_FUNC(grub_putcode) (grub_uint32_t code,

View file

@ -140,7 +140,7 @@ is_authenticated (const char *userlist)
if (!superusers) if (!superusers)
return 1; return 1;
for (user = users; user; user = user->next) FOR_LIST_ELEMENTS (user, users)
{ {
if (!(user->authenticated)) if (!(user->authenticated))
continue; continue;

View file

@ -28,7 +28,7 @@ grub_functional_test (struct grub_extcmd *cmd __attribute__ ((unused)),
{ {
grub_test_t test; grub_test_t test;
for (test = grub_test_list; test; test = test->next) FOR_LIST_ELEMENTS (test, grub_test_list)
grub_test_run (test); grub_test_run (test);
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
} }