struct item* create_dll(void) { struct item *dll = alloc_and_zero(); struct item *now = dll; // NOTE: running this on bare metal may cause the machine to swap a bit int i; for (i = 1; i; ++i) { now->next = alloc_and_zero(); now->next->prev = now; now = now->next; } return dll; }
struct item* create_item(struct item *end) { struct item *pi = alloc_and_zero(); pi->prev = end; end->next = pi; return pi; }
struct item* create_dll(void) { struct item *dll = alloc_and_zero(); struct item *pi = create_item(dll); pi = create_item(pi); pi = create_item(pi); pi = create_item(pi); pi = create_item(pi); pi = create_item(pi); return dll; }
struct item* create_dll(void) { struct item *dll = alloc_and_zero(); dll = create_dll_item(dll); dll = create_dll_item(dll); dll = create_dll_item(dll); dll = create_dll_item(dll); // NOTE: running this on bare metal may cause the machine to swap a bit int i; for (i = 1; i; ++i) dll = create_dll_item(dll); //___sl_plot(NULL); return dll; }
struct item* create_dll_item(struct item *dll) { dll->next = alloc_and_zero(); dll->next->prev = dll; return dll->next; }