[前][次][番号順一覧][スレッド一覧]

ruby-changes:7748

From: akr <ko1@a...>
Date: Tue, 9 Sep 2008 20:57:53 +0900 (JST)
Subject: [ruby-changes:7748] Ruby:r19269 (trunk): * transcode.c (rb_econv_open0): make it static.

akr	2008-09-09 20:57:31 +0900 (Tue, 09 Sep 2008)

  New Revision: 19269

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19269

  Log:
    * transcode.c (rb_econv_open0): make it static.
      (rb_econv_open): place decorators at last.

  Modified files:
    trunk/ChangeLog
    trunk/transcode.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 19268)
+++ ChangeLog	(revision 19269)
@@ -1,3 +1,8 @@
+Tue Sep  9 20:55:55 2008  Tanaka Akira  <akr@f...>
+
+	* transcode.c (rb_econv_open0): make it static.
+	  (rb_econv_open): place decorators at last.
+
 Tue Sep  9 20:40:15 2008  Kazuhiro NISHIYAMA  <zn@m...>
 
 	* test/openssl/test_ssl.rb (OpenSSL#test_client_session):
Index: transcode.c
===================================================================
--- transcode.c	(revision 19268)
+++ transcode.c	(revision 19269)
@@ -878,7 +878,7 @@
     toarg->entries[depth] = get_transcoder_entry(sname, dname);
 }
 
-rb_econv_t *
+static rb_econv_t *
 rb_econv_open0(const char *sname, const char *dname, int ecflags)
 {
     transcoder_entry_t **entries = NULL;
@@ -943,8 +943,8 @@
 rb_econv_open(const char *sname, const char *dname, int ecflags)
 {
     rb_econv_t *ec;
-    int num_encoders, num_decoders;
-    const char *encoders[4], *decoders[1];
+    int num_decorators;
+    const char *decorators[6];
     int i;
 
     if ((ecflags & ECONV_CRLF_NEWLINE_ENCODER) &&
@@ -959,44 +959,38 @@
         (ecflags & ECONV_XML_ATTR_CONTENT_ENCODER))
         return NULL;
 
-    num_encoders = 0;
-    if (ecflags & ECONV_CRLF_NEWLINE_ENCODER)
-        if (!(encoders[num_encoders++] = "crlf_newline"))
-            return NULL;
-    if (ecflags & ECONV_CR_NEWLINE_ENCODER)
-        if (!(encoders[num_encoders++] = "cr_newline"))
-            return NULL;
+    num_decorators = 0;
+
     if (ecflags & ECONV_XML_TEXT_ENCODER)
-        if (!(encoders[num_encoders++] = "xml-text-escaped"))
+        if (!(decorators[num_decorators++] = "xml-text-escaped"))
             return NULL;
     if (ecflags & ECONV_XML_ATTR_CONTENT_ENCODER)
-        if (!(encoders[num_encoders++] = "xml-attr-content-escaped"))
+        if (!(decorators[num_decorators++] = "xml-attr-content-escaped"))
             return NULL;
     if (ecflags & ECONV_XML_ATTR_QUOTE_ENCODER)
-        if (!(encoders[num_encoders++] = "xml-attr-quoted"))
+        if (!(decorators[num_decorators++] = "xml-attr-quoted"))
             return NULL;
 
-    num_decoders = 0;
+    if (ecflags & ECONV_CRLF_NEWLINE_ENCODER)
+        if (!(decorators[num_decorators++] = "crlf_newline"))
+            return NULL;
+    if (ecflags & ECONV_CR_NEWLINE_ENCODER)
+        if (!(decorators[num_decorators++] = "cr_newline"))
+            return NULL;
     if (ecflags & ECONV_UNIVERSAL_NEWLINE_DECODER)
-        if (!(decoders[num_decoders++] = "universal_newline"))
+        if (!(decorators[num_decorators++] = "universal_newline"))
             return NULL;
 
     ec = rb_econv_open0(sname, dname, ecflags & ECONV_ERROR_HANDLER_MASK);
     if (!ec)
         return NULL;
 
-    for (i = 0; i < num_decoders; i++)
-        if (rb_econv_decorate_at_last(ec, decoders[i]) == -1) {
+    for (i = 0; i < num_decorators; i++)
+        if (rb_econv_decorate_at_last(ec, decorators[i]) == -1) {
             rb_econv_close(ec);
             return NULL;
         }
 
-    for (i = num_encoders-1; 0 <= i; i--)
-        if (rb_econv_decorate_at_first(ec, encoders[i]) == -1) {
-            rb_econv_close(ec);
-            return NULL;
-        }
-
     ec->flags |= ecflags & ~ECONV_ERROR_HANDLER_MASK;
 
     return ec;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]