X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdlib%2Ffree.c;fp=functions%2Fstdlib%2Ffree.c;h=0000000000000000000000000000000000000000;hb=2546ca02850b8d684a694dc7373887f7aec994dc;hp=4370487750ad2dbddbc71860833926f1a34de3c7;hpb=b41576197133c1211d6ec353faf93f505f573b8a;p=pdclib diff --git a/functions/stdlib/free.c b/functions/stdlib/free.c deleted file mode 100644 index 4370487..0000000 --- a/functions/stdlib/free.c +++ /dev/null @@ -1,55 +0,0 @@ -/* $Id$ */ - -/* void free( void * ) - - This file is part of the Public Domain C Library (PDCLib). - Permission is granted to use, modify, and / or redistribute at will. -*/ - -#include - -#ifndef REGTEST - -#ifndef _PDCLIB_INT_H -#define _PDCLIB_INT_H _PDCLIB_INT_H -#include <_PDCLIB_int.h> -#endif - -/* TODO: Primitive placeholder. Much room for improvement. */ - -/* structure holding first and last element of free node list */ -extern struct _PDCLIB_headnode_t _PDCLIB_memlist; - -void free( void * ptr ) -{ - if ( ptr == NULL ) - { - return; - } - ptr = (void *)( (char *)ptr - sizeof( struct _PDCLIB_memnode_t ) ); - ( (struct _PDCLIB_memnode_t *)ptr )->next = NULL; - if ( _PDCLIB_memlist.last != NULL ) - { - _PDCLIB_memlist.last->next = ptr; - } - else - { - _PDCLIB_memlist.first = ptr; - } - _PDCLIB_memlist.last = ptr; -} - -#endif - -#ifdef TEST -#include <_PDCLIB_test.h> -#include - -int main( void ) -{ - free( NULL ); - TESTCASE( true ); - return TEST_RESULTS; -} - -#endif