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

ruby-changes:31501

From: glass <ko1@a...>
Date: Fri, 8 Nov 2013 11:37:54 +0900 (JST)
Subject: [ruby-changes:31501] glass:r43580 (trunk): * dir.c, pack.c, ruby.c, struct.c, vm_eval.c: use RARRAY_CONST_PTR().

glass	2013-11-08 11:37:47 +0900 (Fri, 08 Nov 2013)

  New Revision: 43580

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

  Log:
    * dir.c, pack.c, ruby.c, struct.c, vm_eval.c: use RARRAY_CONST_PTR().

  Modified files:
    trunk/ChangeLog
    trunk/dir.c
    trunk/pack.c
    trunk/ruby.c
    trunk/struct.c
    trunk/vm_eval.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43579)
+++ ChangeLog	(revision 43580)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Nov  8 11:35:06 2013  Masaki Matsushita  <glass.saga@g...>
+
+	* dir.c, pack.c, ruby.c, struct.c, vm_eval.c: use RARRAY_CONST_PTR().
+
 Fri Nov  8 10:58:02 2013  Masaki Matsushita  <glass.saga@g...>
 
 	* compile.c (iseq_build_from_ary_exception): use RARRAY_CONST_PTR().
Index: pack.c
===================================================================
--- pack.c	(revision 43579)
+++ pack.c	(revision 43580)
@@ -1798,12 +1798,13 @@ pack_unpack(VALUE str, VALUE fmt) https://github.com/ruby/ruby/blob/trunk/pack.c#L1798
 		s += sizeof(char *);
 
 		if (t) {
-		    VALUE a, *p, *pend;
+		    VALUE a;
+		    const VALUE *p, *pend;
 
 		    if (!(a = rb_str_associated(str))) {
 			rb_raise(rb_eArgError, "no associated pointer");
 		    }
-		    p = RARRAY_PTR(a);
+		    p = RARRAY_CONST_PTR(a);
 		    pend = p + RARRAY_LEN(a);
 		    while (p < pend) {
 			if (RB_TYPE_P(*p, T_STRING) && RSTRING_PTR(*p) == t) {
@@ -1840,12 +1841,13 @@ pack_unpack(VALUE str, VALUE fmt) https://github.com/ruby/ruby/blob/trunk/pack.c#L1841
 		    s += sizeof(char *);
 
 		    if (t) {
-			VALUE a, *p, *pend;
+			VALUE a;
+			const VALUE *p, *pend;
 
 			if (!(a = rb_str_associated(str))) {
 			    rb_raise(rb_eArgError, "no associated pointer");
 			}
-			p = RARRAY_PTR(a);
+			p = RARRAY_CONST_PTR(a);
 			pend = p + RARRAY_LEN(a);
 			while (p < pend) {
 			    if (RB_TYPE_P(*p, T_STRING) && RSTRING_PTR(*p) == t) {
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 43579)
+++ vm_eval.c	(revision 43580)
@@ -757,7 +757,7 @@ rb_apply(VALUE recv, ID mid, VALUE args) https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L757
 	return ret;
     }
     argv = ALLOCA_N(VALUE, argc);
-    MEMCPY(argv, RARRAY_PTR(args), VALUE, argc);
+    MEMCPY(argv, RARRAY_CONST_PTR(args), VALUE, argc);
     return rb_call(recv, mid, argc, argv, CALL_FCALL);
 }
 
@@ -984,7 +984,7 @@ rb_yield_splat(VALUE values) https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L984
     if (NIL_P(tmp)) {
         rb_raise(rb_eArgError, "not an array");
     }
-    v = rb_yield_0(RARRAY_LENINT(tmp), RARRAY_PTR(tmp));
+    v = rb_yield_0(RARRAY_LENINT(tmp), RARRAY_CONST_PTR(tmp));
     return v;
 }
 
Index: dir.c
===================================================================
--- dir.c	(revision 43579)
+++ dir.c	(revision 43580)
@@ -1764,7 +1764,7 @@ rb_push_glob(VALUE str, int flags) /* '\ https://github.com/ruby/ruby/blob/trunk/dir.c#L1764
 }
 
 static VALUE
-dir_globs(long argc, VALUE *argv, int flags)
+dir_globs(long argc, const VALUE *argv, int flags)
 {
     VALUE ary = rb_ary_new();
     long i;
@@ -1891,7 +1891,7 @@ dir_s_glob(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/dir.c#L1891
     }
     else {
 	volatile VALUE v = ary;
-	ary = dir_globs(RARRAY_LEN(v), RARRAY_PTR(v), flags);
+	ary = dir_globs(RARRAY_LEN(v), RARRAY_CONST_PTR(v), flags);
     }
 
     if (rb_block_given_p()) {
Index: struct.c
===================================================================
--- struct.c	(revision 43579)
+++ struct.c	(revision 43580)
@@ -435,7 +435,7 @@ num_members(VALUE klass) https://github.com/ruby/ruby/blob/trunk/struct.c#L435
  */
 
 static VALUE
-rb_struct_initialize_m(int argc, VALUE *argv, VALUE self)
+rb_struct_initialize_m(int argc, const VALUE *argv, VALUE self)
 {
     VALUE klass = rb_obj_class(self);
     long i, n;
@@ -457,7 +457,7 @@ rb_struct_initialize_m(int argc, VALUE * https://github.com/ruby/ruby/blob/trunk/struct.c#L457
 VALUE
 rb_struct_initialize(VALUE self, VALUE values)
 {
-    return rb_struct_initialize_m(RARRAY_LENINT(values), RARRAY_PTR(values), self);
+    return rb_struct_initialize_m(RARRAY_LENINT(values), RARRAY_CONST_PTR(values), self);
 }
 
 static VALUE
Index: ruby.c
===================================================================
--- ruby.c	(revision 43579)
+++ ruby.c	(revision 43580)
@@ -590,11 +590,11 @@ process_sflag(int *sflag) https://github.com/ruby/ruby/blob/trunk/ruby.c#L590
 {
     if (*sflag > 0) {
 	long n;
-	VALUE *args;
+	const VALUE *args;
 	VALUE argv = rb_argv;
 
 	n = RARRAY_LEN(argv);
-	args = RARRAY_PTR(argv);
+	args = RARRAY_CONST_PTR(argv);
 	while (n > 0) {
 	    VALUE v = *args++;
 	    char *s = StringValuePtr(v);

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

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