File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -645,19 +645,21 @@ static VALUE rb_git_repo_merge_base(VALUE self, VALUE rb_args)
645
645
*/
646
646
static VALUE rb_git_repo_merge_bases (VALUE self , VALUE rb_args )
647
647
{
648
- int error = GIT_OK , i ;
648
+ int error = GIT_OK ;
649
+ size_t i , len = (size_t )RARRAY_LEN (rb_args );
649
650
git_repository * repo ;
650
651
git_oidarray bases = {NULL , 0 };
651
- git_oid * input_array = xmalloc (sizeof (git_oid ) * RARRAY_LEN (rb_args ));
652
- int len = (int )RARRAY_LEN (rb_args );
652
+ git_oid * input_array ;
653
653
654
654
VALUE rb_bases ;
655
655
656
656
if (len < 2 )
657
- rb_raise (rb_eArgError , "wrong number of arguments (%d for 2+)" , len );
657
+ rb_raise (rb_eArgError , "wrong number of arguments (%ld for 2+)" , RARRAY_LEN ( rb_args ) );
658
658
659
659
Data_Get_Struct (self , git_repository , repo );
660
660
661
+ input_array = xmalloc (sizeof (git_oid ) * len );
662
+
661
663
for (i = 0 ; !error && i < len ; ++ i ) {
662
664
error = rugged_oid_get (& input_array [i ], repo , rb_ary_entry (rb_args , i ));
663
665
}
You can’t perform that action at this time.
0 commit comments