3 This file is part of the Public Domain C Library (PDCLib).
4 Permission is granted to use, modify, and / or redistribute at will.
11 #include "_PDCLIB_int.h"
13 /* TODO: Primitive placeholder. Much room for improvement. */
15 /* structure holding first and last element of free node list */
16 extern struct _PDCLIB_headnode_t _PDCLIB_memlist;
18 void free( void * ptr )
24 ptr = (void *)( (char *)ptr - sizeof( struct _PDCLIB_memnode_t ) );
25 ( (struct _PDCLIB_memnode_t *)ptr )->next = NULL;
26 if ( _PDCLIB_memlist.last != NULL )
28 _PDCLIB_memlist.last->next = ptr;
32 _PDCLIB_memlist.first = ptr;
34 _PDCLIB_memlist.last = ptr;
40 #include "_PDCLIB_test.h"