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

ruby-changes:33931

From: nobu <ko1@a...>
Date: Mon, 19 May 2014 16:07:01 +0900 (JST)
Subject: [ruby-changes:33931] nobu:r46012 (trunk): string.c: constify

nobu	2014-05-19 16:06:54 +0900 (Mon, 19 May 2014)

  New Revision: 46012

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

  Log:
    string.c: constify
    
    * string.c (rb_str_index): constify local pointer variables.

  Modified files:
    trunk/string.c
Index: string.c
===================================================================
--- string.c	(revision 46011)
+++ string.c	(revision 46012)
@@ -2572,7 +2572,7 @@ rb_str_casecmp(VALUE str1, VALUE str2) https://github.com/ruby/ruby/blob/trunk/string.c#L2572
 static long
 rb_str_index(VALUE str, VALUE sub, long offset)
 {
-    char *s, *sptr, *e;
+    const char *s, *sptr, *e;
     long pos, len, slen;
     int single_byte = single_byte_optimizable(str);
     rb_encoding *enc;
@@ -2600,7 +2600,7 @@ rb_str_index(VALUE str, VALUE sub, long https://github.com/ruby/ruby/blob/trunk/string.c#L2600
     slen = RSTRING_LEN(sub);
     len = RSTRING_LEN(str) - offset;
     for (;;) {
-	char *t;
+	const char *t;
 	pos = rb_memsearch(sptr, slen, s, len, enc);
 	if (pos < 0) return pos;
 	t = rb_enc_right_char_head(s, s+pos, e, enc);

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

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