Store item in List rather than pointer to item

This commit is contained in:
Josh Holtrop 2023-10-25 21:28:27 -04:00
parent f5c6a35cef
commit 6251fee3ff
3 changed files with 5 additions and 5 deletions

View File

@ -13,7 +13,7 @@ struct Acpi
/** /**
* List of ACPI tables. * List of ACPI tables.
*/ */
private static __gshared List!Header tables; private static __gshared List!(Header *) tables;
enum uint XSDT_SIGNATURE = signature("XSDT"); enum uint XSDT_SIGNATURE = signature("XSDT");

View File

@ -13,7 +13,7 @@ struct List(T)
/** /**
* Linked list item. * Linked list item.
*/ */
T * item; T item;
/** /**
* Next list entry. * Next list entry.
@ -23,7 +23,7 @@ struct List(T)
/** /**
* Add an item to this linked list. * Add an item to this linked list.
*/ */
public void add(T * item) public void add(T item)
{ {
List!T * last_entry = last_entry(); List!T * last_entry = last_entry();
List!T * new_entry = A1.allocate!(List!T)(); List!T * new_entry = A1.allocate!(List!T)();
@ -34,7 +34,7 @@ struct List(T)
/** /**
* Allow foreach iteration across a List. * Allow foreach iteration across a List.
*/ */
public int opApply(scope int delegate(T *) dg) public int opApply(scope int delegate(ref T) dg)
{ {
List!T * entry = &this; List!T * entry = &this;
while (entry.next != null) while (entry.next != null)

View File

@ -235,7 +235,7 @@ struct Pci
/** /**
* Store a list of discovered PCI devices. * Store a list of discovered PCI devices.
*/ */
public static __gshared List!Device devices; public static __gshared List!(Device *) devices;
private static uint read_config_register(Address address, uint register_id) private static uint read_config_register(Address address, uint register_id)
{ {