diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-14 10:45:04 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-14 10:45:04 +0000 |
commit | b324a649464f3e51af17002412f0dc5ad95f9fc8 (patch) | |
tree | 2f93bb3b3aab251b5ba27ecbbdee3f0acd94bf4d | |
parent | fff6809b30d84c06c83fcc3fa2cd9e857bd146c9 (diff) | |
download | ruby-b324a649464f3e51af17002412f0dc5ad95f9fc8.tar.gz |
ext/coverage/coverage.c: use long instead of int for coverage site id
Coverage generates unique ID numbers for each branch and each method.
Use long instead of int for the IDs. I don't want to see 2^32 branches
and methods in one file, but just in case...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ext/coverage/coverage.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/coverage/coverage.c b/ext/coverage/coverage.c index 64fe6cb734..cb70b33af9 100644 --- a/ext/coverage/coverage.c +++ b/ext/coverage/coverage.c @@ -73,19 +73,20 @@ branch_coverage(VALUE branches) VALUE ret = rb_hash_new(); VALUE structure = rb_ary_dup(RARRAY_AREF(branches, 0)); VALUE counters = rb_ary_dup(RARRAY_AREF(branches, 1)); - int i, j, id = 0; + int i, j; + long id = 0; for (i = 0; i < RARRAY_LEN(structure); i++) { VALUE branches = RARRAY_AREF(structure, i); VALUE base_type = RARRAY_AREF(branches, 0); VALUE base_lineno = RARRAY_AREF(branches, 1); VALUE children = rb_hash_new(); - rb_hash_aset(ret, rb_ary_new_from_args(3, base_type, INT2FIX(id++), base_lineno), children); + rb_hash_aset(ret, rb_ary_new_from_args(3, base_type, LONG2FIX(id++), base_lineno), children); for (j = 2; j < RARRAY_LEN(branches); j += 3) { VALUE target_label = RARRAY_AREF(branches, j); VALUE target_lineno = RARRAY_AREF(branches, j + 1); int idx = FIX2INT(RARRAY_AREF(branches, j + 2)); - rb_hash_aset(children, rb_ary_new_from_args(3, target_label, INT2FIX(id++), target_lineno), RARRAY_AREF(counters, idx)); + rb_hash_aset(children, rb_ary_new_from_args(3, target_label, LONG2FIX(id++), target_lineno), RARRAY_AREF(counters, idx)); } } @@ -96,13 +97,14 @@ static VALUE method_coverage(VALUE methods) { VALUE ret = rb_hash_new(); - int i, id = 0; + int i; + long id = 0; for (i = 0; i < RARRAY_LEN(methods); ) { VALUE method_name = RARRAY_AREF(methods, i++); VALUE lineno = RARRAY_AREF(methods, i++); VALUE counter = RARRAY_AREF(methods, i++); - rb_hash_aset(ret, rb_ary_new_from_args(3, method_name, INT2FIX(id++), lineno), counter); + rb_hash_aset(ret, rb_ary_new_from_args(3, method_name, LONG2FIX(id++), lineno), counter); } return ret; |