X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdlib%2Fmalloc.c;h=641a859f34565b686c12ad33d8f7c03178098e57;hb=d865c4403fc91d1f1ac95ba76febcee9f429bb97;hp=0b0d6e3c0920b9a9f6a94f832bcc594d621ee1b0;hpb=9f87d9e27e74d9e06e0c93114ffd70a45ee152fa;p=pdclib diff --git a/functions/stdlib/malloc.c b/functions/stdlib/malloc.c index 0b0d6e3..641a859 100644 --- a/functions/stdlib/malloc.c +++ b/functions/stdlib/malloc.c @@ -1,5 +1,3 @@ -/* $Id$ */ - /* void * malloc( size_t ) This file is part of the Public Domain C Library (PDCLib). @@ -12,7 +10,7 @@ #ifndef REGTEST -#include <_PDCLIB_glue.h> +#include "_PDCLIB_glue.h" /* TODO: Primitive placeholder. Much room for improvement. */ @@ -147,7 +145,7 @@ void * malloc( size_t size ) #ifdef TEST -#include <_PDCLIB_test.h> +#include "_PDCLIB_test.h" #include #include #include @@ -242,7 +240,7 @@ int test_nodes( char const * const action, int expected_pages, ... ) PRINT( " - memlist first: %#.4x - last: %#.4x", ( _PDCLIB_memlist.first == NULL ) ? NULL : (char *)_PDCLIB_memlist.first - (char *)pages_start, ( _PDCLIB_memlist.last == NULL ) ? NULL : (char *)_PDCLIB_memlist.last - (char *)pages_start ); - if ( ( firstnode != 0 ) && + if ( ( firstnode != 0 ) && ( ( ( (char *)_PDCLIB_memlist.first - (char *)pages_start ) != firstnode ) || ( ( (char *)_PDCLIB_memlist.last - (char *)pages_start ) != lastnode ) ) ) { @@ -257,7 +255,7 @@ int test_nodes( char const * const action, int expected_pages, ... ) return result; } -#endif +#endif /* Note that this test driver heavily tests *internals* of the implementation above (and of free() and realloc(), too). That means that changes in the @@ -272,7 +270,7 @@ int main( void ) void * ptr1, * ptr2, * ptr3, * ptr4, * ptr5, * ptr6, * ptr7, * ptr8, * ptr9, * ptrA, * ptrB, * ptrC; pages_start = _PDCLIB_allocpages( 0 ); - PRINT( "\nEffective is: %#.4x\nsizeof( memnode ) is: %#.2x\n\n", EFFECTIVE, sizeof( struct _PDCLIB_memnode_t ) ); + PRINT( "\nEffective is: %#.4x\nsizeof( memnode ) is: %#.2x\n\n", EFFECTIVE, sizeof( struct _PDCLIB_memnode_t ) ); /* Allocating 10 bytes; expecting one page allocation and a node split */ TESTCASE( MEMTEST( ptr1, 10 ) );