From 40d0246771c8e593d4b5fdc97dd87b4afd260be2 Mon Sep 17 00:00:00 2001 From: solar Date: Sat, 3 Dec 2005 21:34:32 +0000 Subject: [PATCH] Added #ifdef to allow regression against system lib. --- functions/string/memchr.c | 4 ++++ functions/string/memcmp.c | 4 ++++ functions/string/memcpy.c | 4 ++++ functions/string/memmove.c | 4 ++++ functions/string/memset.c | 4 ++++ functions/string/strcat.c | 5 +++++ functions/string/strchr.c | 4 ++++ functions/string/strcmp.c | 6 ++++++ functions/string/strcoll.c | 7 +++++-- functions/string/strcpy.c | 5 +++++ functions/string/strcspn.c | 4 ++++ functions/string/strlen.c | 4 ++++ functions/string/strncat.c | 4 ++++ functions/string/strncmp.c | 4 ++++ functions/string/strncpy.c | 4 ++++ functions/string/strpbrk.c | 4 ++++ functions/string/strrchr.c | 4 ++++ functions/string/strspn.c | 4 ++++ functions/string/strstr.c | 4 ++++ functions/string/strtok.c | 4 ++++ functions/string/strxfrm.c | 5 ++++- 21 files changed, 89 insertions(+), 3 deletions(-) diff --git a/functions/string/memchr.c b/functions/string/memchr.c index 75809e0..972e7ff 100644 --- a/functions/string/memchr.c +++ b/functions/string/memchr.c @@ -10,6 +10,8 @@ #include +#ifndef REGTEST + void * memchr( const void * s, int c, size_t n ) { const unsigned char * p = (const unsigned char *) s; @@ -24,6 +26,8 @@ void * memchr( const void * s, int c, size_t n ) return NULL; } +#endif + #ifdef TEST #include <_PDCLIB_test.h> diff --git a/functions/string/memcmp.c b/functions/string/memcmp.c index 3ac32a2..167355f 100644 --- a/functions/string/memcmp.c +++ b/functions/string/memcmp.c @@ -10,6 +10,8 @@ #include +#ifndef REGTEST + int memcmp( const void * s1, const void * s2, size_t n ) { const unsigned char * p1 = (const unsigned char *) s1; @@ -26,6 +28,8 @@ int memcmp( const void * s1, const void * s2, size_t n ) return 0; } +#endif + #ifdef TEST #include <_PDCLIB_test.h> diff --git a/functions/string/memcpy.c b/functions/string/memcpy.c index b2606b7..064cc34 100644 --- a/functions/string/memcpy.c +++ b/functions/string/memcpy.c @@ -11,6 +11,8 @@ #include <_PDCLIB_aux.h> #include +#ifndef REGTEST + void * memcpy( void * _PDCLIB_restrict s1, const void * _PDCLIB_restrict s2, size_t n ) { char * dest = (char *) s1; @@ -22,6 +24,8 @@ void * memcpy( void * _PDCLIB_restrict s1, const void * _PDCLIB_restrict s2, siz return s1; } +#endif + #ifdef TEST #include <_PDCLIB_test.h> diff --git a/functions/string/memmove.c b/functions/string/memmove.c index 7c50dee..7a01996 100644 --- a/functions/string/memmove.c +++ b/functions/string/memmove.c @@ -10,6 +10,8 @@ #include +#ifndef REGTEST + void * memmove( void * s1, const void * s2, size_t n ) { char * dest = (char *) s1; @@ -33,6 +35,8 @@ void * memmove( void * s1, const void * s2, size_t n ) return s1; } +#endif + #ifdef TEST #include <_PDCLIB_test.h> diff --git a/functions/string/memset.c b/functions/string/memset.c index 753a333..4abb466 100644 --- a/functions/string/memset.c +++ b/functions/string/memset.c @@ -10,6 +10,8 @@ #include +#ifndef REGTEST + void * memset( void * s, int c, size_t n ) { unsigned char * p = (unsigned char *) s; @@ -20,6 +22,8 @@ void * memset( void * s, int c, size_t n ) return s; } +#endif + #ifdef TEST #include <_PDCLIB_test.h> diff --git a/functions/string/strcat.c b/functions/string/strcat.c index d113575..d960915 100644 --- a/functions/string/strcat.c +++ b/functions/string/strcat.c @@ -9,6 +9,9 @@ */ #include <_PDCLIB_aux.h> +#include + +#ifndef REGTEST char * strcat( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2 ) { @@ -21,6 +24,8 @@ char * strcat( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2 ) return rc; } +#endif + #ifdef TEST #include <_PDCLIB_test.h> diff --git a/functions/string/strchr.c b/functions/string/strchr.c index 96ab051..15155a4 100644 --- a/functions/string/strchr.c +++ b/functions/string/strchr.c @@ -10,6 +10,8 @@ #include +#ifndef REGTEST + char * strchr( const char * s, int c ) { do @@ -22,6 +24,8 @@ char * strchr( const char * s, int c ) return NULL; } +#endif + #ifdef TEST #include <_PDCLIB_test.h> diff --git a/functions/string/strcmp.c b/functions/string/strcmp.c index fea5d2d..6519b01 100644 --- a/functions/string/strcmp.c +++ b/functions/string/strcmp.c @@ -8,6 +8,10 @@ Permission is granted to use, modify, and / or redistribute at will. */ +#include + +#ifndef REGTEST + int strcmp( const char * s1, const char * s2 ) { while ( ( *s1 ) && ( *s1 == *s2 ) ) @@ -18,6 +22,8 @@ int strcmp( const char * s1, const char * s2 ) return ( *s1 - *s2 ); } +#endif + #ifdef TEST #include <_PDCLIB_test.h> diff --git a/functions/string/strcoll.c b/functions/string/strcoll.c index 74a8aad..4b7af32 100644 --- a/functions/string/strcoll.c +++ b/functions/string/strcoll.c @@ -8,15 +8,18 @@ Permission is granted to use, modify, and / or redistribute at will. */ -/* TODO: Dummy function, PDCLib does not support locales yet. */ +#include -int strcmp( const char * s1, const char * s2 ); +#ifndef REGTEST +/* TODO: Dummy function, PDCLib does not support locales yet. */ int strcoll( const char * s1, const char * s2 ) { return strcmp( s1, s2 ); } +#endif + #ifdef TEST #include <_PDCLIB_test.h> diff --git a/functions/string/strcpy.c b/functions/string/strcpy.c index 49204da..8d55b67 100644 --- a/functions/string/strcpy.c +++ b/functions/string/strcpy.c @@ -9,6 +9,9 @@ */ #include <_PDCLIB_aux.h> +#include + +#ifndef REGTEST char * strcpy( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2 ) { @@ -17,6 +20,8 @@ char * strcpy( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2 ) return rc; } +#endif + #ifdef TEST #include <_PDCLIB_test.h> diff --git a/functions/string/strcspn.c b/functions/string/strcspn.c index 01f10e5..68dd8b4 100644 --- a/functions/string/strcspn.c +++ b/functions/string/strcspn.c @@ -10,6 +10,8 @@ #include +#ifndef REGTEST + size_t strcspn( const char * s1, const char * s2 ) { size_t len = 0; @@ -29,6 +31,8 @@ size_t strcspn( const char * s1, const char * s2 ) return len; } +#endif + #ifdef TEST #include <_PDCLIB_test.h> diff --git a/functions/string/strlen.c b/functions/string/strlen.c index 02d105c..17ab3cf 100644 --- a/functions/string/strlen.c +++ b/functions/string/strlen.c @@ -10,6 +10,8 @@ #include +#ifndef REGTEST + size_t strlen( const char * s ) { size_t rc = 0; @@ -20,6 +22,8 @@ size_t strlen( const char * s ) return rc; } +#endif + #ifdef TEST #include <_PDCLIB_test.h> diff --git a/functions/string/strncat.c b/functions/string/strncat.c index 7fdaa26..5720048 100644 --- a/functions/string/strncat.c +++ b/functions/string/strncat.c @@ -11,6 +11,8 @@ #include <_PDCLIB_aux.h> #include +#ifndef REGTEST + char * strncat( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, size_t n ) { char * rc = s1; @@ -29,6 +31,8 @@ char * strncat( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, si return rc; } +#endif + #ifdef TEST #include <_PDCLIB_test.h> diff --git a/functions/string/strncmp.c b/functions/string/strncmp.c index 35a9511..286d41e 100644 --- a/functions/string/strncmp.c +++ b/functions/string/strncmp.c @@ -10,6 +10,8 @@ #include +#ifndef REGTEST + int strncmp( const char * s1, const char * s2, size_t n ) { while ( n && ( *s1 == *s2 ) ) @@ -28,6 +30,8 @@ int strncmp( const char * s1, const char * s2, size_t n ) } } +#endif + #ifdef TEST #include <_PDCLIB_test.h> diff --git a/functions/string/strncpy.c b/functions/string/strncpy.c index 31602ec..ea88d3f 100644 --- a/functions/string/strncpy.c +++ b/functions/string/strncpy.c @@ -11,6 +11,8 @@ #include <_PDCLIB_aux.h> #include +#ifndef REGTEST + char * strncpy( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, size_t n ) { char * rc = s1; @@ -28,6 +30,8 @@ char * strncpy( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, si return rc; } +#endif + #ifdef TEST #include <_PDCLIB_test.h> diff --git a/functions/string/strpbrk.c b/functions/string/strpbrk.c index b317aed..2bec285 100644 --- a/functions/string/strpbrk.c +++ b/functions/string/strpbrk.c @@ -10,6 +10,8 @@ #include +#ifndef REGTEST + char * strpbrk( const char * s1, const char * s2 ) { const char * p1 = s1; @@ -29,6 +31,8 @@ char * strpbrk( const char * s1, const char * s2 ) return NULL; } +#endif + #ifdef TEST #include <_PDCLIB_test.h> diff --git a/functions/string/strrchr.c b/functions/string/strrchr.c index aa4c930..69321b2 100644 --- a/functions/string/strrchr.c +++ b/functions/string/strrchr.c @@ -10,6 +10,8 @@ #include +#ifndef REGTEST + char * strrchr( const char * s, int c ) { size_t i = 0; @@ -24,6 +26,8 @@ char * strrchr( const char * s, int c ) return NULL; } +#endif + #ifdef TEST #include <_PDCLIB_test.h> diff --git a/functions/string/strspn.c b/functions/string/strspn.c index a5859cc..ed9b8b1 100644 --- a/functions/string/strspn.c +++ b/functions/string/strspn.c @@ -10,6 +10,8 @@ #include +#ifndef REGTEST + size_t strspn( const char * s1, const char * s2 ) { size_t len = 0; @@ -34,6 +36,8 @@ size_t strspn( const char * s1, const char * s2 ) return len; } +#endif + #ifdef TEST #include <_PDCLIB_test.h> diff --git a/functions/string/strstr.c b/functions/string/strstr.c index 2ad7505..0856030 100644 --- a/functions/string/strstr.c +++ b/functions/string/strstr.c @@ -10,6 +10,8 @@ #include +#ifndef REGTEST + char * strstr( const char * s1, const char * s2 ) { const char * p1 = s1; @@ -32,6 +34,8 @@ char * strstr( const char * s1, const char * s2 ) return NULL; } +#endif + #ifdef TEST #include <_PDCLIB_test.h> diff --git a/functions/string/strtok.c b/functions/string/strtok.c index 071f4f8..991891d 100644 --- a/functions/string/strtok.c +++ b/functions/string/strtok.c @@ -11,6 +11,8 @@ #include <_PDCLIB_aux.h> #include +#ifndef REGTEST + char * strtok( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2 ) { static char * tmp = NULL; @@ -72,6 +74,8 @@ char * strtok( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2 ) return ( tmp = NULL ); } +#endif + #ifdef TEST #include <_PDCLIB_test.h> diff --git a/functions/string/strxfrm.c b/functions/string/strxfrm.c index 650cfbf..4b81c93 100644 --- a/functions/string/strxfrm.c +++ b/functions/string/strxfrm.c @@ -11,8 +11,9 @@ #include <_PDCLIB_aux.h> #include -/* TODO: Dummy function, no locale support yet. */ +#ifndef REGTEST +/* TODO: Dummy function, no locale support yet. */ size_t strxfrm( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, size_t n ) { size_t len = strlen( s2 ); @@ -26,6 +27,8 @@ size_t strxfrm( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, si return len; } +#endif + #ifdef TEST #include <_PDCLIB_test.h> -- 2.40.0