Skip to content

Commit

Permalink
* array.c (rb_ary_fill): use memfill().
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
glass committed Jul 18, 2013
1 parent e1335a3 commit e07e814
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 2 additions & 5 deletions array.c
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit e07e814

Please sign in to comment.