X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=platform%2Fexample%2Ffunctions%2F_PDCLIB%2Fallocpages.c;h=f5a3609b244184f79c4ae549b40a76e33ab4d69e;hb=b1fc26afebd4d557ff89a44bc21767a8704c3809;hp=48b8dc9cad8ea4ddaa8015501b02a6276db4b42e;hpb=3f6094115e79a45413f08361b68b71eb08da306e;p=pdclib diff --git a/platform/example/functions/_PDCLIB/allocpages.c b/platform/example/functions/_PDCLIB/allocpages.c index 48b8dc9..f5a3609 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 */ @@ -61,16 +56,13 @@ void * _PDCLIB_allocpages( int const n ) #ifdef TEST #include <_PDCLIB_test.h> -int puts( const char * ); - -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 ) );