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

ruby-changes:37333

From: nobu <ko1@a...>
Date: Tue, 27 Jan 2015 13:09:19 +0900 (JST)
Subject: [ruby-changes:37333] nobu:r49414 (trunk): cstr.c: nil iff terminated validly

nobu	2015-01-27 13:09:04 +0900 (Tue, 27 Jan 2015)

  New Revision: 49414

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

  Log:
    cstr.c: nil iff terminated validly
    
    * ext/-test-/string/cstr.c (bug_str_cstr_term_char): return nil
      only when terminated validly.

  Modified files:
    trunk/ext/-test-/string/cstr.c
Index: ext/-test-/string/cstr.c
===================================================================
--- ext/-test-/string/cstr.c	(revision 49413)
+++ ext/-test-/string/cstr.c	(revision 49414)
@@ -36,8 +36,9 @@ bug_str_cstr_term_char(VALUE str) https://github.com/ruby/ruby/blob/trunk/ext/-test-/string/cstr.c#L36
     }
     else {
 	c = rb_enc_mbc_to_codepoint(s, s + len, enc);
+	if (!c) return Qnil;
     }
-    return c ? rb_enc_uint_chr((unsigned int)c, enc) : Qnil;
+    return rb_enc_uint_chr((unsigned int)c, enc);
 }
 
 static VALUE

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

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