aboutsummaryrefslogtreecommitdiffhomepage
path: root/common.c
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2005-12-18 07:32:05 +1000
committerGravatar axel <axel@liljencrantz.se>2005-12-18 07:32:05 +1000
commitb8ea709c1e8f0ad031bae9d5f7b340bd642a8620 (patch)
tree1b203a1693fe6a639b1cf7eba472653c0c2ab1e8 /common.c
parent7bdcfacee4cbed0e90e09a6bcb3ab0dd7f01ae5a (diff)
Add autoconf checks for wide character string functions
darcs-hash:20051217213205-ac50b-df9ea4cbc1a7e4235578bd4fc542ddb7788d41cc.gz
Diffstat (limited to 'common.c')
-rw-r--r--common.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/common.c b/common.c
index 7819a31b..7fc868a0 100644
--- a/common.c
+++ b/common.c
@@ -574,6 +574,7 @@ wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz)
/* count does not include NUL */
}
+#ifndef HAVE_WCSDUP
wchar_t *wcsdup( const wchar_t *in )
{
size_t len=wcslen(in);
@@ -587,10 +588,20 @@ wchar_t *wcsdup( const wchar_t *in )
return out;
}
+#endif
-/**
- Fallback implementation if missing from libc
-*/
+#ifndef HAVE_WCSLEN
+size_t wcslen(const wchar_t *in)
+{
+ const wchar_t *end=in;
+ while( *end )
+ end++;
+ return end-in;
+}
+#endif
+
+
+#ifndef HAVE_WCSCASECMP
int wcscasecmp( const wchar_t *a, const wchar_t *b )
{
if( *a == 0 )
@@ -607,10 +618,10 @@ int wcscasecmp( const wchar_t *a, const wchar_t *b )
else
return wcscasecmp( a+1,b+1);
}
+#endif
-/**
- Fallback implementation if missing from libc
-*/
+
+#ifndef HAVE_WCSNCASECMP
int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count )
{
if( count == 0 )
@@ -630,6 +641,7 @@ int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count )
else
return wcsncasecmp( a+1,b+1, count-1);
}
+#endif
int wcsvarname( wchar_t *str )
{