aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-18 11:51:54 +0000
committerglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-18 11:51:54 +0000
commite07e814ec3c732337153a71eb5718431d8e28a99 (patch)
tree3a5530f983fe4d818a6f5bc7ad6c7846884cd986
parente1335a307c859f612d666245bf891436da8fdd86 (diff)
downloadruby-e07e814ec3c732337153a71eb5718431d8e28a99.tar.gz
* array.c (rb_ary_fill): use memfill().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--array.c7
2 files changed, 6 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 517f376642..3ed5462fd3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Jul 18 20:44:51 2013 Masaki Matsushita <glass.saga@gmail.com>
+
+ * array.c (rb_ary_fill): use memfill().
+
Thu Jul 18 20:35:14 2013 Benoit Daloze <eregontp@gmail.com>
* array.c (rb_ary_count): check length to avoid SEGV
diff --git a/array.c b/array.c
index 0cd2f0d91a..d2b45d9312 100644
--- a/array.c
+++ b/array.c
@@ -3327,7 +3327,7 @@ rb_ary_fill(int argc, VALUE *argv, VALUE ary)
{
VALUE item, arg1, arg2;
long beg = 0, end = 0, len = 0;
- VALUE *p, *pend;
+ VALUE *p;
int block_p = FALSE;
if (rb_block_given_p()) {
@@ -3385,10 +3385,7 @@ rb_ary_fill(int argc, VALUE *argv, VALUE ary)
}
else {
p = RARRAY_PTR(ary) + beg;
- pend = p + len;
- while (p < pend) {
- *p++ = item;
- }
+ memfill(p, len, item);
}
return ary;
}