5 This file is part of the Public Domain C Library (PDCLib).
6 Permission is granted to use, modify, and / or redistribute at will.
13 #include <_PDCLIB_int.h>
15 /* TODO: Primitive placeholder. Much room for improvement. */
17 /* structure holding first and last element of free node list */
18 extern struct _PDCLIB_headnode_t _PDCLIB_memlist;
20 void free( void * ptr )
26 ptr = (void *)( (char *)ptr - sizeof( struct _PDCLIB_memnode_t ) );
27 ( (struct _PDCLIB_memnode_t *)ptr )->next = NULL;
28 if ( _PDCLIB_memlist.last != NULL )
30 _PDCLIB_memlist.last->next = ptr;
34 _PDCLIB_memlist.first = ptr;
36 _PDCLIB_memlist.last = ptr;
42 #include <_PDCLIB_test.h>