From: Tristan Chabredier Date: Wed, 13 Sep 2006 13:09:16 +0000 (+0000) Subject: 2006-09-13 [wwp] 2.4.0cvs182 X-Git-Tag: rel_2_5_0~34 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=0b0be22e99fa6f143b4b7fccf53b716965357d93 2006-09-13 [wwp] 2.4.0cvs182 * configure.ac * src/common/utils.h * src/common/utils.c get rid of unused wide-char functions. --- diff --git a/ChangeLog b/ChangeLog index 762dce13f..7804bf902 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-09-13 [wwp] 2.4.0cvs182 + + * configure.ac + * src/common/utils.h + * src/common/utils.c + get rid of unused wide-char functions. + 2006-09-13 [wwp] 2.4.0cvs181 * src/plugins/pgpinline/sylpheed.def diff --git a/PATCHSETS b/PATCHSETS index a96576dae..e9a2c1103 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -1873,3 +1873,4 @@ ( cvs diff -u -r 1.87.2.29 -r 1.87.2.30 src/folder.h; cvs diff -u -r 1.274.2.149 -r 1.274.2.150 src/mainwindow.c; cvs diff -u -r 1.395.2.247 -r 1.395.2.248 src/summaryview.c; cvs diff -u -r 1.68.2.25 -r 1.68.2.26 src/summaryview.h; ) > 2.4.0cvs179.patchset ( cvs diff -u -r 1.204.2.100 -r 1.204.2.101 src/prefs_common.c; ) > 2.4.0cvs180.patchset ( cvs diff -u -r 1.1.2.4 -r 1.1.2.5 src/plugins/pgpinline/sylpheed.def; cvs diff -u -r 1.96.2.146 -r 1.96.2.147 src/textview.c; ) > 2.4.0cvs181.patchset +( cvs diff -u -r 1.654.2.1920 -r 1.654.2.1921 configure.ac; cvs diff -u -r 1.20.2.37 -r 1.20.2.38 src/common/utils.h; cvs diff -u -r 1.36.2.77 -r 1.36.2.78 src/common/utils.c; ) > 2.4.0cvs182.patchset diff --git a/configure.ac b/configure.ac index 73c11a747..40bf25918 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=4 MICRO_VERSION=0 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=181 +EXTRA_VERSION=182 EXTRA_RELEASE= EXTRA_GTK2_VERSION= @@ -276,8 +276,6 @@ AC_CHECK_SIZEOF(unsigned long, 4) dnl Checks for library functions. AC_FUNC_ALLOCA AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr strchr \ - wcsstr wcswcs iswalnum iswspace towlower \ - wcslen wcscpy wcsncpy \ uname flock lockf inet_aton inet_addr \ fchmod mkstemp truncate getuid regcomp) diff --git a/src/common/utils.c b/src/common/utils.c index bd3fc89a8..2c604d6e9 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -559,210 +559,6 @@ gchar *strncpy2(gchar *dest, const gchar *src, size_t n) return dest; } -#if !HAVE_ISWALNUM -int iswalnum(wint_t wc) -{ - return g_ascii_isalnum((int)wc); -} -#endif - -#if !HAVE_ISWSPACE -int iswspace(wint_t wc) -{ - return g_ascii_isspace((int)wc); -} -#endif - -#if !HAVE_TOWLOWER -wint_t towlower(wint_t wc) -{ - if (wc >= L'A' && wc <= L'Z') - return wc + L'a' - L'A'; - - return wc; -} -#endif - -#if !HAVE_WCSLEN -size_t wcslen(const wchar_t *s) -{ - size_t len = 0; - - while (*s != L'\0') - ++len, ++s; - - return len; -} -#endif - -#if !HAVE_WCSCPY -/* Copy SRC to DEST. */ -wchar_t *wcscpy(wchar_t *dest, const wchar_t *src) -{ - wint_t c; - wchar_t *s = dest; - - do { - c = *src++; - *dest++ = c; - } while (c != L'\0'); - - return s; -} -#endif - -#if !HAVE_WCSNCPY -/* Copy no more than N wide-characters of SRC to DEST. */ -wchar_t *wcsncpy (wchar_t *dest, const wchar_t *src, size_t n) -{ - wint_t c; - wchar_t *s = dest; - - do { - c = *src++; - *dest++ = c; - if (--n == 0) - return s; - } while (c != L'\0'); - - /* zero fill */ - do - *dest++ = L'\0'; - while (--n > 0); - - return s; -} -#endif - -/* Duplicate S, returning an identical malloc'd string. */ -wchar_t *wcsdup(const wchar_t *s) -{ - wchar_t *new_str; - - if (s) { - new_str = g_new(wchar_t, wcslen(s) + 1); - wcscpy(new_str, s); - } else - new_str = NULL; - - return new_str; -} - -/* Duplicate no more than N wide-characters of S, - returning an identical malloc'd string. */ -wchar_t *wcsndup(const wchar_t *s, size_t n) -{ - wchar_t *new_str; - - if (s) { - new_str = g_new(wchar_t, n + 1); - wcsncpy(new_str, s, n); - new_str[n] = (wchar_t)0; - } else - new_str = NULL; - - return new_str; -} - -wchar_t *strdup_mbstowcs(const gchar *s) -{ - wchar_t *new_str; - - if (s) { - new_str = g_new(wchar_t, strlen(s) + 1); - if (mbstowcs(new_str, s, strlen(s) + 1) < 0) { - g_free(new_str); - new_str = NULL; - } else - new_str = g_realloc(new_str, - sizeof(wchar_t) * (wcslen(new_str) + 1)); - } else - new_str = NULL; - - return new_str; -} - -gchar *strdup_wcstombs(const wchar_t *s) -{ - gchar *new_str; - size_t len; - - if (s) { - len = wcslen(s) * MB_CUR_MAX + 1; - new_str = g_new(gchar, len); - if (wcstombs(new_str, s, len) < 0) { - g_free(new_str); - new_str = NULL; - } else - new_str = g_realloc(new_str, strlen(new_str) + 1); - } else - new_str = NULL; - - return new_str; -} - -/* Compare S1 and S2, ignoring case. */ -gint wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n) -{ - wint_t c1; - wint_t c2; - - while (n--) { - c1 = towlower(*s1++); - c2 = towlower(*s2++); - if (c1 != c2) - return c1 - c2; - else if (c1 == 0 && c2 == 0) - break; - } - - return 0; -} - -/* Find the first occurrence of NEEDLE in HAYSTACK, ignoring case. */ -wchar_t *wcscasestr(const wchar_t *haystack, const wchar_t *needle) -{ - register size_t haystack_len, needle_len; - - haystack_len = wcslen(haystack); - needle_len = wcslen(needle); - - if (haystack_len < needle_len || needle_len == 0) - return NULL; - - while (haystack_len >= needle_len) { - if (!wcsncasecmp(haystack, needle, needle_len)) - return (wchar_t *)haystack; - else { - haystack++; - haystack_len--; - } - } - - return NULL; -} - -gint get_mbs_len(const gchar *s) -{ - const gchar *p = s; - gint mb_len; - gint len = 0; - - if (!p) - return -1; - - while (*p != '\0') { - mb_len = g_utf8_skip[*(guchar *)p]; - if (mb_len == 0) - break; - else - len++; - - p += mb_len; - } - - return len; -} /* Examine if next block is non-ASCII string */ gboolean is_next_nonascii(const gchar *s) diff --git a/src/common/utils.h b/src/common/utils.h index a82520ff9..c5b2e9440 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -257,42 +257,6 @@ gchar *strncpy2 (gchar *dest, const gchar *src, size_t n); -/* wide-character functions */ -#if !HAVE_ISWALNUM -int iswalnum (wint_t wc); -#endif -#if !HAVE_ISWSPACE -int iswspace (wint_t wc); -#endif -#if !HAVE_TOWLOWER -wint_t towlower (wint_t wc); -#endif - -#if !HAVE_WCSLEN -size_t wcslen (const wchar_t *s); -#endif -#if !HAVE_WCSCPY -wchar_t *wcscpy (wchar_t *dest, - const wchar_t *src); -#endif -#if !HAVE_WCSNCPY -wchar_t *wcsncpy (wchar_t *dest, - const wchar_t *src, - size_t n); -#endif - -wchar_t *wcsdup (const wchar_t *s); -wchar_t *wcsndup (const wchar_t *s, - size_t n); -wchar_t *strdup_mbstowcs (const gchar *s); -gchar *strdup_wcstombs (const wchar_t *s); -gint wcsncasecmp (const wchar_t *s1, - const wchar_t *s2, - size_t n); -wchar_t *wcscasestr (const wchar_t *haystack, - const wchar_t *needle); -gint get_mbs_len (const gchar *s); - gboolean is_next_nonascii (const gchar *s); gint get_next_word_len (const gchar *s);