summaryrefslogtreecommitdiff
path: root/src/port/string.c
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2009-02-24 14:04:18 +0100
committerAndreas Baumann <abaumann@yahoo.com>2009-02-24 14:04:18 +0100
commitc8808247d13af4a326e69e9c81f8dbf9a62af610 (patch)
tree7fe13322fc0dc64894c448ebc393c0a9a73c726a /src/port/string.c
parentcac9269b115502071175436828c698d7cb4ddc5c (diff)
downloadwolfbones-c8808247d13af4a326e69e9c81f8dbf9a62af610.tar.gz
wolfbones-c8808247d13af4a326e69e9c81f8dbf9a62af610.tar.bz2
better testing: added TEST_ variables in makefiles, added TEST_<feature> macros in test_*.c for easier testing of stub functions
Diffstat (limited to 'src/port/string.c')
-rw-r--r--src/port/string.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/port/string.c b/src/port/string.c
index 01c5228..78c3685 100644
--- a/src/port/string.c
+++ b/src/port/string.c
@@ -22,7 +22,7 @@
* be set which would enable too many non-standard things.
*/
-#if !defined HAVE_STRDUP
+#if !defined HAVE_STRDUP || defined TEST_STRDUP
#include <stdlib.h> /* for malloc, NULL */
@@ -34,14 +34,14 @@ char *wolf_port_strdup( const char *s ) {
return d;
}
-#endif /* !defined HAVE_STRDUP */
+#endif /* !defined HAVE_STRDUP || defined TEST_STRDUP */
/**
* strerror_r exists in various fassions (XSI and GNU flavour in glibc). We stick to
* the API of POSIX.1 of course (XSI-compliant)..
*/
-#if !defined HAVE_STRERROR_R
+#if !defined HAVE_STRERROR_R || defined TEST_STRERROR_R
#include "port/stdio.h" /* for snprintf */
#include <sys/types.h> /* for size_t */
@@ -68,7 +68,7 @@ int wolf_port_strerror_r( int num, char *buf, size_t buflen ) {
return 0;
}
-#endif /* !defined HAVE_STRERROR_R */
+#endif /* !defined HAVE_STRERROR_R || defined TEST_STRERROR_R */
/**
* str(n)casecmp is always around but on very old or strance C libraries.
@@ -77,7 +77,7 @@ int wolf_port_strerror_r( int num, char *buf, size_t buflen ) {
* anyway.
*/
-#if !defined HAVE_STRCASECMP
+#if !defined HAVE_STRCASECMP || defined TEST_STRCASECMP
#include <ctype.h> /* for tolower */
@@ -94,9 +94,9 @@ int wolf_port_strcasecmp( const char *s1, const char *s2 ) {
return( c2 > c1 ? -1 : c1 > c2 );
}
-#endif /* !defined HAVE_STRCASECMP */
+#endif /* !defined HAVE_STRCASECMP || defined TEST_STRCASECMP */
-#if !defined HAVE_STRNCASECMP
+#if !defined HAVE_STRNCASECMP || defined TEST_STRNCASECMP
#include <ctype.h> /* for tolower */
@@ -117,4 +117,4 @@ int wolf_port_strncasecmp( const char *s1, const char *s2, size_t n ) {
return( c2 > c1 ? -1 : c1 > c2 );
}
-#endif /* !defined HAVE_STRNCASECMP */
+#endif /* !defined HAVE_STRNCASECMP || defined TEST_STRNCASECMP */