aboutsummaryrefslogtreecommitdiffstats
path: root/ext/date/date_core.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-04 07:27:10 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-04 07:27:10 +0000
commit3553a86eb51365cc524cf5c549b37770448d550d (patch)
tree9a96e1d3ccc6de7a94b8d884ddb946b3c3701de3 /ext/date/date_core.c
parent52912db4a81f9b9b69ab9e9fcd95e22d086d4289 (diff)
downloadruby-3553a86eb51365cc524cf5c549b37770448d550d.tar.gz
ext: use RARRAY_CONST_PTR
* ext/bigdecimal/bigdecimal.c: use RARRAY_CONST_PTR just fore reference instead of RARRAY_PTR, to keep the array WB-protected. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/date/date_core.c')
-rw-r--r--ext/date/date_core.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/ext/date/date_core.c b/ext/date/date_core.c
index 1b87b09c55..642a0e4398 100644
--- a/ext/date/date_core.c
+++ b/ext/date/date_core.c
@@ -3826,14 +3826,14 @@ rt_complete_frags(VALUE klass, VALUE hash)
for (i = 0; i < RARRAY_LEN(tab); i++) {
VALUE x, a;
- x = RARRAY_PTR(tab)[i];
- a = RARRAY_PTR(x)[1];
+ x = RARRAY_CONST_PTR(tab)[i];
+ a = RARRAY_CONST_PTR(x)[1];
{
long j, n = 0;
for (j = 0; j < RARRAY_LEN(a); j++)
- if (!NIL_P(ref_hash0(RARRAY_PTR(a)[j])))
+ if (!NIL_P(ref_hash0(RARRAY_CONST_PTR(a)[j])))
n++;
if (n > eno) {
eno = n;
@@ -3845,8 +3845,8 @@ rt_complete_frags(VALUE klass, VALUE hash)
g = 0;
else {
g = 1;
- k = RARRAY_PTR(RARRAY_PTR(tab)[idx])[0];
- a = RARRAY_PTR(RARRAY_PTR(tab)[idx])[1];
+ k = RARRAY_CONST_PTR(RARRAY_CONST_PTR(tab)[idx])[0];
+ a = RARRAY_CONST_PTR(RARRAY_CONST_PTR(tab)[idx])[1];
e = eno;
}
}
@@ -3867,7 +3867,7 @@ rt_complete_frags(VALUE klass, VALUE hash)
long i;
for (i = 0; i < RARRAY_LEN(a); i++) {
- VALUE e = RARRAY_PTR(a)[i];
+ VALUE e = RARRAY_CONST_PTR(a)[i];
if (!NIL_P(ref_hash0(e)))
break;
@@ -3884,7 +3884,7 @@ rt_complete_frags(VALUE klass, VALUE hash)
long i;
for (i = 0; i < RARRAY_LEN(a); i++) {
- VALUE e = RARRAY_PTR(a)[i];
+ VALUE e = RARRAY_CONST_PTR(a)[i];
if (!NIL_P(ref_hash0(e)))
break;
@@ -3908,7 +3908,7 @@ rt_complete_frags(VALUE klass, VALUE hash)
long i;
for (i = 0; i < RARRAY_LEN(a); i++) {
- VALUE e = RARRAY_PTR(a)[i];
+ VALUE e = RARRAY_CONST_PTR(a)[i];
if (!NIL_P(ref_hash0(e)))
break;
@@ -3925,7 +3925,7 @@ rt_complete_frags(VALUE klass, VALUE hash)
long i;
for (i = 0; i < RARRAY_LEN(a); i++) {
- VALUE e = RARRAY_PTR(a)[i];
+ VALUE e = RARRAY_CONST_PTR(a)[i];
if (!NIL_P(ref_hash0(e)))
break;
@@ -7085,16 +7085,16 @@ d_lite_marshal_load(VALUE self, VALUE a)
if (RARRAY_LEN(a) == 2) {
- ajd = f_sub(RARRAY_PTR(a)[0], half_days_in_day);
+ ajd = f_sub(RARRAY_CONST_PTR(a)[0], half_days_in_day);
of = INT2FIX(0);
- sg = RARRAY_PTR(a)[1];
+ sg = RARRAY_CONST_PTR(a)[1];
if (!k_numeric_p(sg))
sg = DBL2NUM(RTEST(sg) ? GREGORIAN : JULIAN);
}
else {
- ajd = RARRAY_PTR(a)[0];
- of = RARRAY_PTR(a)[1];
- sg = RARRAY_PTR(a)[2];
+ ajd = RARRAY_CONST_PTR(a)[0];
+ of = RARRAY_CONST_PTR(a)[1];
+ sg = RARRAY_CONST_PTR(a)[2];
}
old_to_new(ajd, of, sg,
@@ -7119,12 +7119,12 @@ d_lite_marshal_load(VALUE self, VALUE a)
int jd, df, of;
double sg;
- nth = RARRAY_PTR(a)[0];
- jd = NUM2INT(RARRAY_PTR(a)[1]);
- df = NUM2INT(RARRAY_PTR(a)[2]);
- sf = RARRAY_PTR(a)[3];
- of = NUM2INT(RARRAY_PTR(a)[4]);
- sg = NUM2DBL(RARRAY_PTR(a)[5]);
+ nth = RARRAY_CONST_PTR(a)[0];
+ jd = NUM2INT(RARRAY_CONST_PTR(a)[1]);
+ df = NUM2INT(RARRAY_CONST_PTR(a)[2]);
+ sf = RARRAY_CONST_PTR(a)[3];
+ of = NUM2INT(RARRAY_CONST_PTR(a)[4]);
+ sg = NUM2DBL(RARRAY_CONST_PTR(a)[5]);
if (!df && f_zero_p(sf) && !of) {
set_to_simple(self, &dat->s, nth, jd, sg, 0, 0, 0, HAVE_JD);
} else {