X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=platform%2Fexample%2Ffunctions%2F_PDCLIB%2Fallocpages.c;h=435e8c64b8840fa7c429f2faadaf9d81caca3d8a;hb=b08f4b52b1cd1f7a9553c0f357a7c90859fa3e73;hp=48b8dc9cad8ea4ddaa8015501b02a6276db4b42e;hpb=3f6094115e79a45413f08361b68b71eb08da306e;p=pdclib diff --git a/platform/example/functions/_PDCLIB/allocpages.c b/platform/example/functions/_PDCLIB/allocpages.c index 48b8dc9..435e8c6 100644 --- a/platform/example/functions/_PDCLIB/allocpages.c +++ b/platform/example/functions/_PDCLIB/allocpages.c @@ -1,7 +1,5 @@ /* $Id$ */ -/* Release $Name$ */ - /* _PDCLIB_allocpages( int const ) This file is part of the Public Domain C Library (PDCLib). @@ -13,12 +11,14 @@ */ #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> +#ifndef _PDCLIB_GLUE_H +#define _PDCLIB_GLUE_H _PDCLIB_GLUE_H +#include <_PDCLIB_glue.h> #endif static void * membreak = NULL; @@ -39,7 +39,7 @@ void * _PDCLIB_allocpages( int const n ) /* error */ return NULL; } - membreak += unaligned; + membreak = (char *)membreak + unaligned; } } /* increasing or decreasing heap - standard operation */ @@ -61,16 +61,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 ) );