Generic linked list function
I have three types of linked list in a program:
Code:
GFX_ENTRY* gfx_ls;
GFX_ENTRY* gfx_le;
TILEDEF* tile_ls;
TILEDEF* tile_le;
SPRITEDEF* sprite_ls;
SPRITEDEF* sprite_le;
Obviously, GFX_ENTRY, TILEDEF and SPRITEDEF are linked list structs. Each of them has a different set of data, but common to each are the next and prev pointers, and a char* name.
Is it possible to create a single function to allocate and link a new entry into any of the three lists? I suspect void pointers may come into play here, but I'm not sure in what way.
Cheers.