[pypy-commit] pypy default: Fix the test by properly calling CODEC_INIT.

arigo noreply at buildbot.pypy.org
Thu May 12 16:39:15 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r44107:1a382602c9d6
Date: 2011-05-12 16:46 +0200
http://bitbucket.org/pypy/pypy/changeset/1a382602c9d6/

Log:	Fix the test by properly calling CODEC_INIT.

diff --git a/pypy/translator/c/src/cjkcodecs/cjkcodecs.h b/pypy/translator/c/src/cjkcodecs/cjkcodecs.h
--- a/pypy/translator/c/src/cjkcodecs/cjkcodecs.h
+++ b/pypy/translator/c/src/cjkcodecs/cjkcodecs.h
@@ -209,11 +209,15 @@
 #define END_MAPPINGS_LIST /* empty */
 
 #define BEGIN_CODECS_LIST /* empty */
-#define _CODEC(name)                                    \
-  static const MultibyteCodec _pypy_cjkcodec_##name;    \
-  const MultibyteCodec *pypy_cjkcodec_##name(void) {    \
-    return &_pypy_cjkcodec_##name;                      \
-  }                                                     \
+#define _CODEC(name)                                                    \
+  static const MultibyteCodec _pypy_cjkcodec_##name;                    \
+  const MultibyteCodec *pypy_cjkcodec_##name(void) {                    \
+    if (_pypy_cjkcodec_##name.codecinit != NULL) {                      \
+      int r = _pypy_cjkcodec_##name.codecinit(_pypy_cjkcodec_##name.config); \
+      assert(r == 0);                                                   \
+    }                                                                   \
+    return &_pypy_cjkcodec_##name;                                      \
+  }                                                                     \
   static const MultibyteCodec _pypy_cjkcodec_##name
 #define _STATEFUL_METHODS(enc)          \
     enc##_encode,                       \


More information about the pypy-commit mailing list