Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/lib/libc/citrus Pull up revision 1.18 (requested by yam...



details:   https://anonhg.NetBSD.org/src/rev/9f0fecd06b6b
branches:  netbsd-1-6
changeset: 530246:9f0fecd06b6b
user:      tron <tron%NetBSD.org@localhost>
date:      Mon Jun 02 15:03:42 2003 +0000

description:
Pull up revision 1.18 (requested by yamt in ticket #1202):
- add missing _CEI_TO_EI/_TO_CEI.
- add missing _STATE_NEEDS_EXPLICIT_INIT checks.
- more comment.

diffstat:

 lib/libc/citrus/citrus_ctype_template.h |  22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diffs (63 lines):

diff -r e6d917eef53a -r 9f0fecd06b6b lib/libc/citrus/citrus_ctype_template.h
--- a/lib/libc/citrus/citrus_ctype_template.h   Mon Jun 02 15:01:14 2003 +0000
+++ b/lib/libc/citrus/citrus_ctype_template.h   Mon Jun 02 15:03:42 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: citrus_ctype_template.h,v 1.13.2.4 2003/06/02 15:01:14 tron Exp $      */
+/*     $NetBSD: citrus_ctype_template.h,v 1.13.2.5 2003/06/02 15:03:42 tron Exp $      */
 
 /*-
  * Copyright (c)2002 Citrus Project,
@@ -113,6 +113,8 @@
  *     non-zero integral value.  Otherwise, 0.
  *
  *   _STATE_NEEDS_EXPLICIT_INIT(ps) :
+ *     some encodings, states needs some explicit initialization.
+ *     (ie. initialization with memset isn't enough.)
  *     If the encoding state pointed by "ps" needs to be initialized
  *     explicitly, return non-zero. Otherwize, 0.
  *
@@ -419,12 +421,14 @@
                       const char * __restrict s, size_t n,
                       int * __restrict nresult)
 {
+       _ENCODING_STATE *psenc = &_CEI_TO_STATE(_TO_CEI(cl), mblen);
+       _ENCODING_INFO *ei = _CEI_TO_EI(_TO_CEI(cl));
 
        _DIAGASSERT(cl != NULL);
 
-       return _FUNCNAME(mbtowc_priv)(_CEI_TO_EI(_TO_CEI(cl)), NULL, s, n,
-                                     &_CEI_TO_STATE(_TO_CEI(cl), mblen),
-                                     nresult);
+       if (_STATE_NEEDS_EXPLICIT_INIT(psenc))
+               _FUNCNAME(init_state)(ei, psenc);
+       return _FUNCNAME(mbtowc_priv)(ei, NULL, s, n, psenc, nresult);
 }
 
 static int
@@ -535,12 +539,14 @@
                        const char * __restrict s, size_t n,
                        int * __restrict nresult)
 {
+       _ENCODING_STATE *psenc = &_CEI_TO_STATE(_TO_CEI(cl), mbtowc);
+       _ENCODING_INFO *ei = _CEI_TO_EI(_TO_CEI(cl));
 
        _DIAGASSERT(cl != NULL);
 
-       return _FUNCNAME(mbtowc_priv)(cl, pwc, s, n,
-                                     &_CEI_TO_STATE(_TO_CEI(cl), mbtowc),
-                                     nresult);
+       if (_STATE_NEEDS_EXPLICIT_INIT(psenc))
+               _FUNCNAME(init_state)(ei, psenc);
+       return _FUNCNAME(mbtowc_priv)(ei, pwc, s, n, psenc, nresult);
 }
 
 static int
@@ -609,6 +615,8 @@
        _DIAGASSERT(cl != NULL);
 
        psenc = &_CEI_TO_STATE(_TO_CEI(cl), wctomb);
+       if (_STATE_NEEDS_EXPLICIT_INIT(psenc))
+               _FUNCNAME(init_state)(_CEI_TO_EI(_TO_CEI(cl)), psenc);
        if (s == NULL) {
                _FUNCNAME(init_state)(_CEI_TO_EI(_TO_CEI(cl)), psenc);
                *nresult = _ENCODING_IS_STATE_DEPENDENT;



Home | Main Index | Thread Index | Old Index