summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--dir.c4
-rw-r--r--pack.c10
-rw-r--r--ruby.c4
-rw-r--r--struct.c4
-rw-r--r--vm_eval.c4
6 files changed, 18 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 4611e02..56fa8a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Fri Nov 8 11:35:06 2013 Masaki Matsushita <glass.saga@gmail.com>
+
+ * 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@gmail.com>
* compile.c (iseq_build_from_ary_exception): use RARRAY_CONST_PTR().
diff --git a/dir.c b/dir.c
index 5e36270..e3a74c1 100644
--- a/dir.c
+++ b/dir.c
@@ -1764,7 +1764,7 @@ rb_push_glob(VALUE str, int flags) /* '\0' is delimiter */
}
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 obj)
}
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()) {
diff --git a/pack.c b/pack.c
index aba976a..71dd6af 100644
--- a/pack.c
+++ b/pack.c
@@ -1798,12 +1798,13 @@ pack_unpack(VALUE str, VALUE fmt)
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)
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) {
diff --git a/ruby.c b/ruby.c
index e73fc48..0532c1a 100644
--- a/ruby.c
+++ b/ruby.c
@@ -590,11 +590,11 @@ process_sflag(int *sflag)
{
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);
diff --git a/struct.c b/struct.c
index bae826b..a961ac8 100644
--- a/struct.c
+++ b/struct.c
@@ -435,7 +435,7 @@ num_members(VALUE klass)
*/
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 *argv, VALUE self)
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
diff --git a/vm_eval.c b/vm_eval.c
index 09ddaae..bace6bb 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -757,7 +757,7 @@ rb_apply(VALUE recv, ID mid, VALUE args)
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)
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;
}