7 This file is part of the Public Domain C Library (PDCLib).
8 Permission is granted to use, modify, and / or redistribute at will.
16 #define _PDCLIB_INT_H _PDCLIB_INT_H
17 #include <_PDCLIB_int.h>
20 /* TODO: Primitive placeholder. Much room for improvement. */
22 /* structure holding first and last element of free node list */
23 extern struct _PDCLIB_headnode_t _PDCLIB_memlist;
25 void free( void * ptr )
27 ptr = (void *)( (char *)ptr - sizeof( struct _PDCLIB_memnode_t ) );
28 ( (struct _PDCLIB_memnode_t *)ptr )->next = NULL;
29 if ( _PDCLIB_memlist.last != NULL )
31 _PDCLIB_memlist.last->next = ptr;
35 _PDCLIB_memlist.first = ptr;
37 _PDCLIB_memlist.last = ptr;
43 #include <_PDCLIB_test.h>
48 /* tests covered in malloc test driver */