X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=platform%2Fexample%2Ffunctions%2F_PDCLIB%2Fallocpages.c;h=081adfb99993847b1d267cf882eb47ba348e7255;hb=d6f1494a4f38a212b29a13ee713885058dcf0fe7;hp=48b8dc9cad8ea4ddaa8015501b02a6276db4b42e;hpb=3f6094115e79a45413f08361b68b71eb08da306e;p=pdclib diff --git a/platform/example/functions/_PDCLIB/allocpages.c b/platform/example/functions/_PDCLIB/allocpages.c index 48b8dc9..081adfb 100644 --- a/platform/example/functions/_PDCLIB/allocpages.c +++ b/platform/example/functions/_PDCLIB/allocpages.c @@ -1,7 +1,3 @@ -/* $Id$ */ - -/* Release $Name$ */ - /* _PDCLIB_allocpages( int const ) This file is part of the Public Domain C Library (PDCLib). @@ -13,13 +9,12 @@ */ #include +#include -#include +int brk( void * ); +void * sbrk( intptr_t ); -#ifndef _PDCLIB_CONFIG_H -#define _PDCLIB_CONFIG_H _PDCLIB_CONFIG_H -#include <_PDCLIB_config.h> -#endif +#include "_PDCLIB_glue.h" static void * membreak = NULL; @@ -39,7 +34,7 @@ void * _PDCLIB_allocpages( int const n ) /* error */ return NULL; } - membreak += unaligned; + membreak = (char *)membreak + unaligned; } } /* increasing or decreasing heap - standard operation */ @@ -59,18 +54,15 @@ void * _PDCLIB_allocpages( int const n ) } #ifdef TEST -#include <_PDCLIB_test.h> - -int puts( const char * ); +#include "_PDCLIB_test.h" -int main() +int main( void ) { - BEGIN_TESTS; #ifndef REGTEST { - void * startbreak = sbrk( 0 ); + char * startbreak = sbrk( 0 ); TESTCASE( _PDCLIB_allocpages( 0 ) ); - TESTCASE( ( sbrk( 0 ) - startbreak ) <= _PDCLIB_PAGESIZE ); + TESTCASE( ( (char *)sbrk( 0 ) - startbreak ) <= _PDCLIB_PAGESIZE ); startbreak = sbrk( 0 ); TESTCASE( _PDCLIB_allocpages( 1 ) ); TESTCASE( sbrk( 0 ) == startbreak + ( 1 * _PDCLIB_PAGESIZE ) );