From: Martin Baute Date: Fri, 25 Mar 2016 18:18:14 +0000 (+0100) Subject: More fixes. X-Git-Url: https://pd.if.org/git/?p=pdclib;a=commitdiff_plain;h=d7154dc8cd1b7d41d0d956b7310e59d794f1a59f More fixes. --- diff --git a/functions/stdlib/atexit.c b/functions/stdlib/atexit.c index 42a98ed..11aae09 100644 --- a/functions/stdlib/atexit.c +++ b/functions/stdlib/atexit.c @@ -8,18 +8,18 @@ #ifndef REGTEST -extern void (*_PDCLIB_regstack[])( void ); -extern size_t _PDCLIB_regptr; +extern void (*_PDCLIB_exitstack[])( void ); +extern size_t _PDCLIB_exitptr; int atexit( void (*func)( void ) ) { - if ( _PDCLIB_regptr == 0 ) + if ( _PDCLIB_exitptr == 0 ) { return -1; } else { - _PDCLIB_regstack[ --_PDCLIB_regptr ] = func; + _PDCLIB_exitstack[ --_PDCLIB_exitptr ] = func; return 0; } } diff --git a/functions/stdlib/exit.c b/functions/stdlib/exit.c index b922cb0..e636a32 100644 --- a/functions/stdlib/exit.c +++ b/functions/stdlib/exit.c @@ -17,14 +17,14 @@ */ #define NUMBER_OF_SLOTS 40 -void (*_PDCLIB_regstack[ NUMBER_OF_SLOTS ])( void ) = { _PDCLIB_closeall }; -size_t _PDCLIB_regptr = NUMBER_OF_SLOTS; +void (*_PDCLIB_exitstack[ NUMBER_OF_SLOTS ])( void ) = { _PDCLIB_closeall }; +size_t _PDCLIB_exitptr = NUMBER_OF_SLOTS; void exit( int status ) { - while ( _PDCLIB_regptr < NUMBER_OF_SLOTS ) + while ( _PDCLIB_exitptr < NUMBER_OF_SLOTS ) { - _PDCLIB_regstack[ _PDCLIB_regptr++ ](); + _PDCLIB_exitstack[ _PDCLIB_exitptr++ ](); } _Exit( status ); } diff --git a/functions/stdlib/qsort.c b/functions/stdlib/qsort.c index e26ea86..582d1f9 100644 --- a/functions/stdlib/qsort.c +++ b/functions/stdlib/qsort.c @@ -154,7 +154,7 @@ int main( void ) strcpy( s, presort ); qsort( s, 1, 1, compare ); TESTCASE( strcmp( s, presort ) == 0 ); -#if __BSD_VISIBLE +#if defined( REGTEST ) && ( defined( __BSD_VISIBLE ) || defined( __APPLE__ ) ) puts( "qsort.c: Skipping test #4 for BSD as it goes into endless loop here." ); #else qsort( s, 100, 0, compare ); diff --git a/functions/string/strerror.c b/functions/string/strerror.c index 59747f1..8c9f876 100644 --- a/functions/string/strerror.c +++ b/functions/string/strerror.c @@ -13,7 +13,7 @@ /* TODO: Doing this via a static array is not the way to do it. */ char * strerror( int errnum ) { - if ( errnum == 0 || errnum >= _PDCLIB_ERRNO_MAX ) + if ( errnum >= _PDCLIB_ERRNO_MAX ) { return (char *)"Unknown error"; } diff --git a/functions/string/strncmp.c b/functions/string/strncmp.c index 1e9119d..2965b0d 100644 --- a/functions/string/strncmp.c +++ b/functions/string/strncmp.c @@ -16,7 +16,7 @@ int strncmp( const char * s1, const char * s2, size_t n ) ++s2; --n; } - if ( ( n == 0 ) ) + if ( n == 0 ) { return 0; }