2013-05-02 20:54:52 +00:00
|
|
|
From d2ccb3209c62de4292107df4207c02ee59dc11a9 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
|
|
|
|
Date: Mon, 2 Jul 2012 11:19:22 +0200
|
2013-06-12 19:24:37 +00:00
|
|
|
Subject: [PATCH 004/482] * include/grub/list.h
|
2013-05-02 20:54:52 +00:00
|
|
|
(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.
|
|
|
|
|
|
|
|
---
|
|
|
|
grub-core/commands/help.c | 5 +++--
|
|
|
|
include/grub/command.h | 1 +
|
|
|
|
include/grub/list.h | 1 +
|
|
|
|
3 files changed, 5 insertions(+), 2 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/grub-core/commands/help.c b/grub-core/commands/help.c
|
|
|
|
index d64c289..f0be89b 100644
|
|
|
|
--- a/grub-core/commands/help.c
|
|
|
|
+++ b/grub-core/commands/help.c
|
|
|
|
@@ -99,12 +99,13 @@ grub_cmd_help (grub_extcmd_context_t ctxt __attribute__ ((unused)), int argc,
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
- grub_command_t cmd_iter, cmd;
|
|
|
|
+ grub_command_t cmd_iter, cmd, cmd_next;
|
|
|
|
|
|
|
|
for (i = 0; i < argc; i++)
|
|
|
|
{
|
|
|
|
currarg = args[i];
|
|
|
|
- FOR_COMMANDS(cmd_iter)
|
|
|
|
+
|
|
|
|
+ FOR_COMMANDS_SAFE (cmd_iter, cmd_next)
|
|
|
|
{
|
|
|
|
if (!(cmd_iter->prio & GRUB_COMMAND_FLAG_ACTIVE))
|
|
|
|
continue;
|
|
|
|
diff --git a/include/grub/command.h b/include/grub/command.h
|
|
|
|
index 6d43499..8705a63 100644
|
|
|
|
--- a/include/grub/command.h
|
|
|
|
+++ b/include/grub/command.h
|
|
|
|
@@ -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_SAFE(var, next) FOR_LIST_ELEMENTS_SAFE((var), (next), grub_command_list)
|
|
|
|
|
|
|
|
void grub_register_core_commands (void);
|
|
|
|
|
|
|
|
diff --git a/include/grub/list.h b/include/grub/list.h
|
|
|
|
index cadb2d9..6f6dec0 100644
|
|
|
|
--- a/include/grub/list.h
|
|
|
|
+++ b/include/grub/list.h
|
|
|
|
@@ -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);
|
|
|
|
|
|
|
|
#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 *
|
|
|
|
grub_bad_type_cast_real (int line, const char *file)
|
|
|
|
--
|
2013-06-07 18:03:56 +00:00
|
|
|
1.8.2.1
|
2013-05-02 20:54:52 +00:00
|
|
|
|