diff options
author | axel <axel@liljencrantz.se> | 2005-12-18 07:32:05 +1000 |
---|---|---|
committer | axel <axel@liljencrantz.se> | 2005-12-18 07:32:05 +1000 |
commit | b8ea709c1e8f0ad031bae9d5f7b340bd642a8620 (patch) | |
tree | 1b203a1693fe6a639b1cf7eba472653c0c2ab1e8 /common.c | |
parent | 7bdcfacee4cbed0e90e09a6bcb3ab0dd7f01ae5a (diff) |
Add autoconf checks for wide character string functions
darcs-hash:20051217213205-ac50b-df9ea4cbc1a7e4235578bd4fc542ddb7788d41cc.gz
Diffstat (limited to 'common.c')
-rw-r--r-- | common.c | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -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 ) { |