mirror of
https://github.com/ipxe/ipxe
synced 2025-12-30 13:11:11 +03:00
[tables] Redefine methods for accessing linker tables
Intel's C compiler (icc) chokes on the zero-length arrays that we currently use as part of the mechanism for accessing linker table entries. Abstract away the zero-length arrays, to make a port to icc easier. Introduce macros such as for_each_table_entry() to simplify the common case of iterating over all entries in a linker table. Represent table names as #defined string constants rather than unquoted literals; this avoids visual confusion between table names and C variable or type names, and also allows us to force a compilation error in the event of incorrect table names.
This commit is contained in:
@@ -72,11 +72,6 @@
|
||||
*/
|
||||
uint16_t isapnp_read_port;
|
||||
|
||||
static struct isapnp_driver isapnp_drivers[0]
|
||||
__table_start ( struct isapnp_driver, isapnp_drivers );
|
||||
static struct isapnp_driver isapnp_drivers_end[0]
|
||||
__table_end ( struct isapnp_driver, isapnp_drivers );
|
||||
|
||||
static void isapnpbus_remove ( struct root_device *rootdev );
|
||||
|
||||
/*
|
||||
@@ -594,7 +589,7 @@ static int isapnp_probe ( struct isapnp_device *isapnp ) {
|
||||
isa_id_string ( isapnp->vendor_id, isapnp->prod_id ),
|
||||
isapnp->ioaddr, isapnp->irqno );
|
||||
|
||||
for ( driver = isapnp_drivers; driver < isapnp_drivers_end; driver++ ){
|
||||
for_each_table_entry ( driver, ISAPNP_DRIVERS ) {
|
||||
for ( i = 0 ; i < driver->id_count ; i++ ) {
|
||||
id = &driver->ids[i];
|
||||
if ( id->vendor_id != isapnp->vendor_id )
|
||||
|
||||
Reference in New Issue
Block a user