[util] reverse linked list
This commit is contained in:
parent
b6f96d8275
commit
dce02a9302
|
@ -0,0 +1,14 @@
|
|||
#include "functions.h"
|
||||
#include <stddef.h>
|
||||
|
||||
void* ax__reverse_list(void* l)
|
||||
{
|
||||
void* next;
|
||||
void* rev = NULL;
|
||||
for (void** list = l; list != NULL; list = next) {
|
||||
next = *list;
|
||||
*list = rev;
|
||||
rev = list;
|
||||
}
|
||||
return rev;
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
void* ax__reverse_list(void* list);
|
Loading…
Reference in New Issue