X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=opt%2Fmalloc-solar%2Ffree.c;fp=opt%2Fmalloc-solar%2Ffree.c;h=0000000000000000000000000000000000000000;hp=71d6b0f61b9622a62666b59a8c408d42b6468183;hb=81b6302395f77a0d4e0771cb9e1cef80188d9474;hpb=d7f375a09a9912bb18ad42f1442fbf64311bfed6 diff --git a/opt/malloc-solar/free.c b/opt/malloc-solar/free.c deleted file mode 100644 index 71d6b0f..0000000 --- a/opt/malloc-solar/free.c +++ /dev/null @@ -1,53 +0,0 @@ -/* 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