diff options
author | kientzle <kientzle@FreeBSD.org> | 2007-04-14 02:37:22 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2007-04-14 02:37:22 +0000 |
commit | 06c7ab197542b866eabdc016004b744e8720c6f6 (patch) | |
tree | 568743dd038378291a88b1ec614d65bb763717a7 /lib/libarchive/archive_entry.c | |
parent | dff4ea292c7a48641ee96f58a7cfe8807733f5ed (diff) | |
download | FreeBSD-src-06c7ab197542b866eabdc016004b744e8720c6f6.zip FreeBSD-src-06c7ab197542b866eabdc016004b744e8720c6f6.tar.gz |
More portability improvements from Martin Koeppe:
conditionally use utime() when utimes() is not available;
allow the most common wide-char functions to be replaced
when local alternatives are lacking.
Diffstat (limited to 'lib/libarchive/archive_entry.c')
-rw-r--r-- | lib/libarchive/archive_entry.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/libarchive/archive_entry.c b/lib/libarchive/archive_entry.c index c498bc0..8309d4f 100644 --- a/lib/libarchive/archive_entry.c +++ b/lib/libarchive/archive_entry.c @@ -59,18 +59,11 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_STRING_H #include <string.h> #endif - -/* Obtain suitable wide-character manipulation functions. */ #ifdef HAVE_WCHAR_H #include <wchar.h> -#else -static size_t wcslen(const wchar_t *s) -{ - const wchar_t *p = s; - while (*p != L'\0') - ++p; - return p - s; -} +#endif + +#ifndef HAVE_WCSCPY static wchar_t * wcscpy(wchar_t *s1, const wchar_t *s2) { wchar_t *dest = s1; @@ -78,10 +71,23 @@ static wchar_t * wcscpy(wchar_t *s1, const wchar_t *s2) ++s1, ++s2; return dest; } -#define wmemcpy(a,b,i) (wchar_t *)memcpy((a), (b), (i) * sizeof(wchar_t)) +#endif +#ifndef HAVE_WCSLEN +static size_t wcslen(const wchar_t *s) +{ + const wchar_t *p = s; + while (*p != L'\0') + ++p; + return p - s; +} +#endif +#ifndef HAVE_WMEMCMP /* Good enough for simple equality testing, but not for sorting. */ #define wmemcmp(a,b,i) memcmp((a), (b), (i) * sizeof(wchar_t)) #endif +#ifndef HAVE_WMEMCPY +#define wmemcpy(a,b,i) (wchar_t *)memcpy((a), (b), (i) * sizeof(wchar_t)) +#endif #include "archive.h" #include "archive_entry.h" |