Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/locale remove duplicated towctrans internal function.
details: https://anonhg.NetBSD.org/src/rev/2398e68d52e6
branches: trunk
changeset: 755349:2398e68d52e6
user: tnozaki <tnozaki%NetBSD.org@localhost>
date: Wed Jun 02 15:47:25 2010 +0000
description:
remove duplicated towctrans internal function.
diffstat:
lib/libc/locale/_wctrans.c | 6 +++---
lib/libc/locale/_wctrans_local.h | 6 +++---
lib/libc/locale/_wctype.c | 38 ++------------------------------------
lib/libc/locale/_wctype_local.h | 3 +--
lib/libc/locale/iswctype_mb.c | 10 ++++------
5 files changed, 13 insertions(+), 50 deletions(-)
diffs (168 lines):
diff -r dca713f8e159 -r 2398e68d52e6 lib/libc/locale/_wctrans.c
--- a/lib/libc/locale/_wctrans.c Wed Jun 02 12:07:03 2010 +0000
+++ b/lib/libc/locale/_wctrans.c Wed Jun 02 15:47:25 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: _wctrans.c,v 1.15 2010/06/01 13:52:08 tnozaki Exp $ */
+/* $NetBSD: _wctrans.c,v 1.16 2010/06/02 15:47:25 tnozaki Exp $ */
/*-
* Copyright (c)2003 Citrus Project,
@@ -60,7 +60,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _wctrans.c,v 1.15 2010/06/01 13:52:08 tnozaki Exp $");
+__RCSID("$NetBSD: _wctrans.c,v 1.16 2010/06/02 15:47:25 tnozaki Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -77,7 +77,7 @@
* translate a character (extended part)
*/
wint_t
-_towctrans_ext(wint_t c, struct _WCTransEntry *te)
+_towctrans_ext(wint_t c, struct _WCTransEntry const *te)
{
__nbrune_t c0;
uint32_t x;
diff -r dca713f8e159 -r 2398e68d52e6 lib/libc/locale/_wctrans_local.h
--- a/lib/libc/locale/_wctrans_local.h Wed Jun 02 12:07:03 2010 +0000
+++ b/lib/libc/locale/_wctrans_local.h Wed Jun 02 15:47:25 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: _wctrans_local.h,v 1.8 2009/02/12 05:00:46 lukem Exp $ */
+/* $NetBSD: _wctrans_local.h,v 1.9 2010/06/02 15:47:25 tnozaki Exp $ */
/*-
* Copyright (c)2003 Citrus Project,
@@ -30,11 +30,11 @@
#define _WCTRANS_LOCAL_H_
__BEGIN_DECLS
-wint_t _towctrans_ext(wint_t, _WCTransEntry *);
+wint_t _towctrans_ext(wint_t, _WCTransEntry const *);
__END_DECLS
static __inline wint_t
-_towctrans(wint_t c, _WCTransEntry *te)
+_towctrans_priv(wint_t c, _WCTransEntry const *te)
{
return (_RUNE_ISCACHED(c)
? (wint_t)te->te_cached[(size_t)c]
diff -r dca713f8e159 -r 2398e68d52e6 lib/libc/locale/_wctype.c
--- a/lib/libc/locale/_wctype.c Wed Jun 02 12:07:03 2010 +0000
+++ b/lib/libc/locale/_wctype.c Wed Jun 02 15:47:25 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: _wctype.c,v 1.7 2010/06/01 13:52:08 tnozaki Exp $ */
+/* $NetBSD: _wctype.c,v 1.8 2010/06/02 15:47:25 tnozaki Exp $ */
/*-
* Copyright (c)2008 Citrus Project,
@@ -60,7 +60,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _wctype.c,v 1.7 2010/06/01 13:52:08 tnozaki Exp $");
+__RCSID("$NetBSD: _wctype.c,v 1.8 2010/06/02 15:47:25 tnozaki Exp $");
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -110,37 +110,3 @@
{
return !!(_runetype_priv(rl, wc) & te->te_mask);
}
-
-wint_t
-/*ARGSUSED*/
-_towctrans_priv(_RuneLocale const *rl,
- wint_t wc, _WCTransEntry const *te)
-{
- __nbrune_t wc0;
- _RuneRange *rr;
- _RuneEntry *base, *re;
- uint32_t x;
-
- _DIAGASSERT(rl != NULL);
- _DIAGASSERT(te != NULL);
-
- if (wc == WEOF)
- return wc;
- _DIAGASSERT(te->te_name != NULL);
- if (_RUNE_ISCACHED(wc))
- return te->te_cached[(size_t)wc];
- wc0 = (__nbrune_t)wc;
- rr = te->te_extmap;
- _DIAGASSERT(rr != NULL);
- base = rr->rr_rune_ranges;
- for (x = rr->rr_nranges; x != (uint32_t)0; x >>= 1) {
- re = base + (x >> 1);
- if (re->re_min <= wc0 && re->re_max >= wc0) {
- return re->re_map + wc0 - re->re_min;
- } else if (wc0 >= re->re_max) {
- base = re + 1;
- --x;
- }
- }
- return wc;
-}
diff -r dca713f8e159 -r 2398e68d52e6 lib/libc/locale/_wctype_local.h
--- a/lib/libc/locale/_wctype_local.h Wed Jun 02 12:07:03 2010 +0000
+++ b/lib/libc/locale/_wctype_local.h Wed Jun 02 15:47:25 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: _wctype_local.h,v 1.2 2009/01/11 02:46:28 christos Exp $ */
+/* $NetBSD: _wctype_local.h,v 1.3 2010/06/02 15:47:25 tnozaki Exp $ */
/*-
* Copyright (c) 2008 Citrus Project,
@@ -32,7 +32,6 @@
__BEGIN_DECLS
_RuneType _runetype_priv(_RuneLocale const *, wint_t);
int _iswctype_priv(_RuneLocale const *, wint_t, _WCTypeEntry const *);
-wint_t _towctrans_priv(_RuneLocale const *, wint_t, _WCTransEntry const *);
__END_DECLS
#endif /*_WCTYPE_LOCAL_H_*/
diff -r dca713f8e159 -r 2398e68d52e6 lib/libc/locale/iswctype_mb.c
--- a/lib/libc/locale/iswctype_mb.c Wed Jun 02 12:07:03 2010 +0000
+++ b/lib/libc/locale/iswctype_mb.c Wed Jun 02 15:47:25 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iswctype_mb.c,v 1.8 2010/06/01 13:52:08 tnozaki Exp $ */
+/* $NetBSD: iswctype_mb.c,v 1.9 2010/06/02 15:47:25 tnozaki Exp $ */
/*-
* Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: iswctype_mb.c,v 1.8 2010/06/01 13:52:08 tnozaki Exp $");
+__RCSID("$NetBSD: iswctype_mb.c,v 1.9 2010/06/02 15:47:25 tnozaki Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -82,7 +82,7 @@
\
rl = _RUNE_LOCALE(); \
te = &rl->rl_wctrans[index]; \
- return _towctrans_priv(rl, wc, te); \
+ return _towctrans_priv(wc, te); \
}
_TOWCTRANS_FUNC(upper, _WCTRANS_INDEX_UPPER)
_TOWCTRANS_FUNC(lower, _WCTRANS_INDEX_LOWER)
@@ -134,16 +134,14 @@
wint_t
towctrans(wint_t wc, wctrans_t charmap)
{
- _RuneLocale const *rl;
_WCTransEntry const *te;
if (charmap == NULL) {
errno = EINVAL;
return wc;
}
- rl = _RUNE_LOCALE();
te = (_WCTransEntry const *)(void *)charmap;
- return _towctrans_priv(rl, wc, te);
+ return _towctrans_priv(wc, te);
}
__weak_alias(wcwidth,_wcwidth)
Home |
Main Index |
Thread Index |
Old Index