]> pd.if.org Git - pdclib/commitdiff
More fixes.
authorMartin Baute <solar@rootdirectory.de>
Fri, 25 Mar 2016 18:18:14 +0000 (19:18 +0100)
committerMartin Baute <solar@rootdirectory.de>
Fri, 25 Mar 2016 18:18:14 +0000 (19:18 +0100)
functions/stdlib/atexit.c
functions/stdlib/exit.c
functions/stdlib/qsort.c
functions/string/strerror.c
functions/string/strncmp.c

index 42a98ed0dec0689537dca0a2373fd7f7e9056b4b..11aae09d0d0ca71b08ce1c5f718e58215f437536 100644 (file)
@@ -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;
     }
 }
index b922cb01b7d80b0f3ff0d97ec03769d2514cc91b..e636a32e4a683de0464ab697d32142144334b9df 100644 (file)
 */
 #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 );
 }
index e26ea863cfa9e9f702236538921281ea7c7ab688..582d1f9313acfd8da8240b93f052314460d4a7d6 100644 (file)
@@ -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 );
index 59747f1d8491dc48b934dc398c2968d9f7f75500..8c9f8764b7b2eb45ed15d1f486671b258981e2b9 100644 (file)
@@ -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";
     }
index 1e9119dbd56ec0d70888a681a257452bad549e4d..2965b0d37bd029724f461ec2641f848b57fe1bda 100644 (file)
@@ -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;
     }