aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2023-02-20 13:46:45 +0000
committerMichael Brown <mcb30@ipxe.org>2023-02-20 13:46:45 +0000
commit6625e49cea9fb9316b8eeee9b68a06ea4508bb77 (patch)
tree6868ae61e58a66b6e07bc4053da5f6504c2731aa
parent9f17d1116d27696ec76c48c5c77df34cba521380 (diff)
downloadipxe-6625e49cea9fb9316b8eeee9b68a06ea4508bb77.zip
ipxe-6625e49cea9fb9316b8eeee9b68a06ea4508bb77.tar.gz
ipxe-6625e49cea9fb9316b8eeee9b68a06ea4508bb77.tar.bz2
[tables] Allow any lvalue to be used as a table iterator
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/include/ipxe/tables.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/include/ipxe/tables.h b/src/include/ipxe/tables.h
index de5b1f2..ac17f4b 100644
--- a/src/include/ipxe/tables.h
+++ b/src/include/ipxe/tables.h
@@ -383,9 +383,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*
*/
#define for_each_table_entry( pointer, table ) \
- for ( pointer = table_start ( table ) ; \
- pointer < table_end ( table ) ; \
- pointer++ )
+ for ( (pointer) = table_start ( table ) ; \
+ (pointer) < table_end ( table ) ; \
+ (pointer)++ )
/**
* Iterate through all remaining entries within a linker table
@@ -412,9 +412,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*
*/
#define for_each_table_entry_continue( pointer, table ) \
- for ( pointer++ ; \
- pointer < table_end ( table ) ; \
- pointer++ )
+ for ( (pointer)++ ; \
+ (pointer) < table_end ( table ) ; \
+ (pointer)++ )
/**
* Iterate through all entries within a linker table in reverse order
@@ -438,9 +438,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*
*/
#define for_each_table_entry_reverse( pointer, table ) \
- for ( pointer = ( table_end ( table ) - 1 ) ; \
- pointer >= table_start ( table ) ; \
- pointer-- )
+ for ( (pointer) = ( table_end ( table ) - 1 ) ; \
+ (pointer) >= table_start ( table ) ; \
+ (pointer)-- )
/**
* Iterate through all remaining entries within a linker table in reverse order
@@ -467,8 +467,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*
*/
#define for_each_table_entry_continue_reverse( pointer, table ) \
- for ( pointer-- ; \
- pointer >= table_start ( table ) ; \
- pointer-- )
+ for ( (pointer)-- ; \
+ (pointer) >= table_start ( table ) ; \
+ (pointer)-- )
#endif /* _IPXE_TABLES_H */