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