* include/grub/list.h (FOR_LIST_ELEMENTS_SAFE): New macro.
* include/grub/command.h (FOR_COMMANDS_SAFE): Likewise. * grub-core/commands/help.c (grub_cmd_help): Use FOR_COMMANDS_SAFE.
This commit is contained in:
parent
3569288126
commit
a18f3b98c6
3 changed files with 5 additions and 2 deletions
|
@ -99,12 +99,13 @@ grub_cmd_help (grub_extcmd_context_t ctxt __attribute__ ((unused)), int argc,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
grub_command_t cmd_iter, cmd;
|
grub_command_t cmd_iter, cmd, cmd_next;
|
||||||
|
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
{
|
{
|
||||||
currarg = args[i];
|
currarg = args[i];
|
||||||
FOR_COMMANDS(cmd_iter)
|
|
||||||
|
FOR_COMMANDS_SAFE (cmd_iter, cmd_next)
|
||||||
{
|
{
|
||||||
if (!(cmd_iter->prio & GRUB_COMMAND_FLAG_ACTIVE))
|
if (!(cmd_iter->prio & GRUB_COMMAND_FLAG_ACTIVE))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -121,6 +121,7 @@ grub_command_execute (const char *name, int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FOR_COMMANDS(var) FOR_LIST_ELEMENTS((var), grub_command_list)
|
#define FOR_COMMANDS(var) FOR_LIST_ELEMENTS((var), grub_command_list)
|
||||||
|
#define FOR_COMMANDS_SAFE(var, next) FOR_LIST_ELEMENTS_SAFE((var), (next), grub_command_list)
|
||||||
|
|
||||||
void grub_register_core_commands (void);
|
void grub_register_core_commands (void);
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ void EXPORT_FUNC(grub_list_push) (grub_list_t *head, grub_list_t item);
|
||||||
void EXPORT_FUNC(grub_list_remove) (grub_list_t item);
|
void EXPORT_FUNC(grub_list_remove) (grub_list_t item);
|
||||||
|
|
||||||
#define FOR_LIST_ELEMENTS(var, list) for ((var) = (list); (var); (var) = (var)->next)
|
#define FOR_LIST_ELEMENTS(var, list) for ((var) = (list); (var); (var) = (var)->next)
|
||||||
|
#define FOR_LIST_ELEMENTS_SAFE(var, nxt, list) for ((var) = (list), (nxt) = ((var) ? (var)->next : 0); (var); (var) = (nxt), (nxt) = (var)->next)
|
||||||
|
|
||||||
static inline void *
|
static inline void *
|
||||||
grub_bad_type_cast_real (int line, const char *file)
|
grub_bad_type_cast_real (int line, const char *file)
|
||||||
|
|
Loading…
Reference in a new issue