Created
January 7, 2019 20:40
-
-
Save movitto/adeb3f3eee9aaaaf52dfc860d37c18be to your computer and use it in GitHub Desktop.
Update sonic-pi vendored *rugged* dep to work with ruby 2.5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_blame.c b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_blame.c | |
index 91716301f..9acd33253 100644 | |
--- a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_blame.c | |
+++ b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_blame.c | |
@@ -188,6 +188,11 @@ static VALUE rb_git_blame_count(VALUE self) | |
return UINT2NUM(git_blame_get_hunk_count(blame)); | |
} | |
+static VALUE rugged_blame_enum_size(VALUE rb_blame, VALUE rb_args, VALUE rb_eobj) | |
+{ | |
+ return rb_git_blame_count(rb_blame); | |
+} | |
+ | |
/* | |
* call-seq: | |
* blame[index] -> hunk | |
@@ -242,9 +247,7 @@ static VALUE rb_git_blame_each(VALUE self) | |
git_blame *blame; | |
uint32_t i, blame_count; | |
- if (!rb_block_given_p()) { | |
- return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each"), self); | |
- } | |
+ RETURN_SIZED_ENUMERATOR(self, 0, 0, rugged_blame_enum_size); | |
Data_Get_Struct(self, git_blame, blame); | |
diff --git a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_branch_collection.c b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_branch_collection.c | |
index b1975fbc7..21389aea5 100644 | |
--- a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_branch_collection.c | |
+++ b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_branch_collection.c | |
@@ -178,19 +178,16 @@ static VALUE rb_git_branch_collection_aref(VALUE self, VALUE rb_name) { | |
static VALUE each_branch(int argc, VALUE *argv, VALUE self, int branch_names_only) | |
{ | |
- VALUE rb_repo = rugged_owner(self), rb_filter; | |
+ VALUE rb_repo, rb_filter; | |
git_repository *repo; | |
git_branch_iterator *iter; | |
int error, exception = 0; | |
git_branch_t filter = (GIT_BRANCH_LOCAL | GIT_BRANCH_REMOTE), branch_type; | |
+ RETURN_ENUMERATOR(self, argc, argv); | |
rb_scan_args(argc, argv, "01", &rb_filter); | |
- if (!rb_block_given_p()) { | |
- VALUE symbol = branch_names_only ? CSTR2SYM("each_name") : CSTR2SYM("each"); | |
- return rb_funcall(self, rb_intern("to_enum"), 2, symbol, rb_filter); | |
- } | |
- | |
+ rb_repo = rugged_owner(self); | |
rugged_check_repo(rb_repo); | |
if (!NIL_P(rb_filter)) | |
diff --git a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_config.c b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_config.c | |
index 634684261..0feec9d19 100644 | |
--- a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_config.c | |
+++ b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_config.c | |
@@ -212,11 +212,9 @@ static VALUE rb_git_config_each_key(VALUE self) | |
git_config *config; | |
int error; | |
+ RETURN_ENUMERATOR(self, 0, 0); | |
Data_Get_Struct(self, git_config, config); | |
- if (!rb_block_given_p()) | |
- return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each_key")); | |
- | |
error = git_config_foreach(config, &cb_config__each_key, (void *)rb_block_proc()); | |
rugged_exception_check(error); | |
return Qnil; | |
@@ -241,11 +239,9 @@ static VALUE rb_git_config_each_pair(VALUE self) | |
git_config *config; | |
int error; | |
+ RETURN_ENUMERATOR(self, 0, 0); | |
Data_Get_Struct(self, git_config, config); | |
- if (!rb_block_given_p()) | |
- return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each_pair")); | |
- | |
error = git_config_foreach(config, &cb_config__each_pair, (void *)rb_block_proc()); | |
rugged_exception_check(error); | |
return Qnil; | |
diff --git a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_diff.c b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_diff.c | |
index 7810c5ab7..83c3d9f78 100644 | |
--- a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_diff.c | |
+++ b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_diff.c | |
@@ -447,10 +447,7 @@ static VALUE rb_git_diff_each_patch(VALUE self) | |
int error = 0; | |
size_t d, delta_count; | |
- if (!rb_block_given_p()) { | |
- return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each_patch"), self); | |
- } | |
- | |
+ RETURN_ENUMERATOR(self, 0, 0); | |
Data_Get_Struct(self, git_diff, diff); | |
delta_count = git_diff_num_deltas(diff); | |
@@ -484,10 +481,7 @@ static VALUE rb_git_diff_each_delta(VALUE self) | |
int error = 0; | |
size_t d, delta_count; | |
- if (!rb_block_given_p()) { | |
- return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each_delta"), self); | |
- } | |
- | |
+ RETURN_ENUMERATOR(self, 0, 0); | |
Data_Get_Struct(self, git_diff, diff); | |
delta_count = git_diff_num_deltas(diff); | |
@@ -524,6 +518,7 @@ static VALUE rb_git_diff_each_line(int argc, VALUE *argv, VALUE self) | |
git_diff_format_t format; | |
int exception = 0, error; | |
+ RETURN_ENUMERATOR(self, argc, argv); | |
Data_Get_Struct(self, git_diff, diff); | |
if (rb_scan_args(argc, argv, "01", &rb_format) == 1) { | |
@@ -532,9 +527,6 @@ static VALUE rb_git_diff_each_line(int argc, VALUE *argv, VALUE self) | |
rb_format = CSTR2SYM("patch"); | |
} | |
- if (!rb_block_given_p()) | |
- return rb_funcall(self, rb_intern("to_enum"), 2, CSTR2SYM("each_line"), rb_format); | |
- | |
if (SYM2ID(rb_format) == rb_intern("patch")) { | |
format = GIT_DIFF_FORMAT_PATCH; | |
} else if (SYM2ID(rb_format) == rb_intern("patch_header")) { | |
diff --git a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_diff_hunk.c b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_diff_hunk.c | |
index bc7212a6e..180fa2e29 100644 | |
--- a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_diff_hunk.c | |
+++ b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_diff_hunk.c | |
@@ -42,10 +42,7 @@ static VALUE rb_git_diff_hunk_each_line(VALUE self) | |
git_patch *patch; | |
int error = 0, l, lines_count, hunk_idx; | |
- if (!rb_block_given_p()) { | |
- return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each_line"), self); | |
- } | |
- | |
+ RETURN_ENUMERATOR(self, 0, 0); | |
Data_Get_Struct(rugged_owner(self), git_patch, patch); | |
lines_count = FIX2INT(rb_iv_get(self, "@line_count")); | |
diff --git a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_index.c b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_index.c | |
index dc52497ef..d49f71290 100644 | |
--- a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_index.c | |
+++ b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_index.c | |
@@ -190,11 +190,9 @@ static VALUE rb_git_index_each(VALUE self) | |
git_index *index; | |
unsigned int i, count; | |
+ RETURN_ENUMERATOR(self, 0, 0); | |
Data_Get_Struct(self, git_index, index); | |
- if (!rb_block_given_p()) | |
- return rb_funcall(self, rb_intern("to_enum"), 0); | |
- | |
count = (unsigned int)git_index_entrycount(index); | |
for (i = 0; i < count; ++i) { | |
const git_index_entry *entry = git_index_get_byindex(index, i); | |
diff --git a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_note.c b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_note.c | |
index ea2f0c5c2..dd3611c4b 100644 | |
--- a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_note.c | |
+++ b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_note.c | |
@@ -297,12 +297,9 @@ static VALUE rb_git_note_each(int argc, VALUE *argv, VALUE self) | |
struct rugged_cb_payload payload = { self, 0 }; | |
VALUE rb_notes_ref; | |
+ RETURN_ENUMERATOR(self, argc, argv); | |
rb_scan_args(argc, argv, "01", &rb_notes_ref); | |
- if (!rb_block_given_p()) { | |
- return rb_funcall(self, rb_intern("to_enum"), 3, CSTR2SYM("each_note"), self, rb_notes_ref); | |
- } | |
- | |
if (!NIL_P(rb_notes_ref)) { | |
Check_Type(rb_notes_ref, T_STRING); | |
notes_ref = StringValueCStr(rb_notes_ref); | |
diff --git a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_patch.c b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_patch.c | |
index 140d24d64..fcc5d72b2 100644 | |
--- a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_patch.c | |
+++ b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_patch.c | |
@@ -93,10 +93,7 @@ static VALUE rb_git_diff_patch_each_hunk(VALUE self) | |
int error = 0; | |
size_t hunks_count, h; | |
- if (!rb_block_given_p()) { | |
- return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each_hunk"), self); | |
- } | |
- | |
+ RETURN_ENUMERATOR(self, 0, 0); | |
Data_Get_Struct(self, git_patch, patch); | |
hunks_count = git_patch_num_hunks(patch); | |
diff --git a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_reference_collection.c b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_reference_collection.c | |
index f335c2a69..d22af1a1e 100644 | |
--- a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_reference_collection.c | |
+++ b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_reference_collection.c | |
@@ -114,15 +114,9 @@ static VALUE rb_git_reference_collection__each(int argc, VALUE *argv, VALUE self | |
git_reference_iterator *iter; | |
int error, exception = 0; | |
+ RETURN_ENUMERATOR(self, argc, argv); | |
rb_scan_args(argc, argv, "01", &rb_glob); | |
- if (!rb_block_given_p()) { | |
- return rb_funcall(self, | |
- rb_intern("to_enum"), 2, | |
- only_names ? CSTR2SYM("each_name") : CSTR2SYM("each"), | |
- rb_glob); | |
- } | |
- | |
rugged_check_repo(rb_repo); | |
Data_Get_Struct(rb_repo, git_repository, repo); | |
diff --git a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_remote.c b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_remote.c | |
index 6c19397e8..be6f2ba2e 100644 | |
--- a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_remote.c | |
+++ b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_remote.c | |
@@ -304,13 +304,10 @@ static VALUE rb_git_remote_ls(int argc, VALUE *argv, VALUE self) | |
int error; | |
size_t heads_len, i; | |
+ RETURN_ENUMERATOR(self, argc, argv); | |
Data_Get_Struct(self, git_remote, remote); | |
- | |
rb_scan_args(argc, argv, ":", &rb_options); | |
- if (!rb_block_given_p()) | |
- return rb_funcall(self, rb_intern("to_enum"), 2, CSTR2SYM("ls"), rb_options); | |
- | |
rugged_remote_init_callbacks_and_payload_from_options(rb_options, &callbacks, &payload); | |
init_custom_headers(rb_options, &custom_headers); | |
diff --git a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_remote_collection.c b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_remote_collection.c | |
index ce9ca03f1..3f8b319c6 100644 | |
--- a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_remote_collection.c | |
+++ b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_remote_collection.c | |
@@ -139,12 +139,7 @@ static VALUE rb_git_remote_collection__each(VALUE self, int only_names) | |
VALUE rb_repo; | |
- if (!rb_block_given_p()) { | |
- if (only_names) | |
- return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each_name")); | |
- else | |
- return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each")); | |
- } | |
+ RETURN_ENUMERATOR(self, 0, 0); | |
rb_repo = rugged_owner(self); | |
rugged_check_repo(rb_repo); | |
diff --git a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_repo.c b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_repo.c | |
index 1ac827a23..e119fa1e7 100644 | |
--- a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_repo.c | |
+++ b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_repo.c | |
@@ -1569,9 +1569,7 @@ static VALUE rb_git_repo_each_id(VALUE self) | |
git_odb *odb; | |
int error, exception = 0; | |
- if (!rb_block_given_p()) | |
- return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each_id")); | |
- | |
+ RETURN_ENUMERATOR(self, 0, 0); | |
Data_Get_Struct(self, git_repository, repo); | |
error = git_repository_odb(&odb, repo); | |
diff --git a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_revwalk.c b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_revwalk.c | |
index 582f32a3d..7fceb050a 100644 | |
--- a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_revwalk.c | |
+++ b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_revwalk.c | |
@@ -365,14 +365,9 @@ static VALUE rb_git_walk(int argc, VALUE *argv, VALUE self) | |
struct walk_options w; | |
int exception = 0; | |
+ RETURN_ENUMERATOR(self, argc, argv); | |
rb_scan_args(argc, argv, "10:", &rb_repo, &rb_options); | |
- if (!rb_block_given_p()) { | |
- ID iter_method = ID2SYM(rb_intern("walk")); | |
- return rb_funcall(self, rb_intern("to_enum"), 3, | |
- iter_method, rb_repo, rb_options); | |
- } | |
- | |
Data_Get_Struct(rb_repo, git_repository, w.repo); | |
rugged_exception_check(git_revwalk_new(&w.walk, w.repo)); | |
@@ -402,13 +397,9 @@ static VALUE rb_git_walk_with_opts(int argc, VALUE *argv, VALUE self, int oid_on | |
VALUE rb_options; | |
struct walk_options w; | |
+ RETURN_ENUMERATOR(self, argc, argv); | |
rb_scan_args(argc, argv, "01", &rb_options); | |
- if (!rb_block_given_p()) { | |
- ID iter_method = ID2SYM(rb_intern(oid_only ? "each_oid" : "each")); | |
- return rb_funcall(self, rb_intern("to_enum"), 2, iter_method, rb_options); | |
- } | |
- | |
Data_Get_Struct(self, git_revwalk, w.walk); | |
w.repo = git_revwalk_repository(w.walk); | |
diff --git a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_submodule_collection.c b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_submodule_collection.c | |
index 23799793a..bc1d50d23 100644 | |
--- a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_submodule_collection.c | |
+++ b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_submodule_collection.c | |
@@ -125,12 +125,11 @@ static VALUE rb_git_submodule_collection_each(VALUE self) | |
int error; | |
struct rugged_cb_payload payload; | |
- VALUE rb_repo = rugged_owner(self); | |
+ VALUE rb_repo; | |
+ RETURN_ENUMERATOR(self, 0, 0); | |
+ rb_repo = rugged_owner(self); | |
Data_Get_Struct(rb_repo, git_repository, repo); | |
- if (!rb_block_given_p()) | |
- return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each")); | |
- | |
payload.exception = 0; | |
payload.rb_data = rb_repo; | |
diff --git a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_tag_collection.c b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_tag_collection.c | |
index 11942c159..84dc70e7f 100644 | |
--- a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_tag_collection.c | |
+++ b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_tag_collection.c | |
@@ -236,13 +236,9 @@ static VALUE each_tag(int argc, VALUE *argv, VALUE self, int tag_names_only) | |
VALUE rb_repo = rugged_owner(self), rb_pattern; | |
const char *pattern = NULL; | |
+ RETURN_ENUMERATOR(self, argc, argv); | |
rb_scan_args(argc, argv, "01", &rb_pattern); | |
- if (!rb_block_given_p()) { | |
- VALUE symbol = tag_names_only ? CSTR2SYM("each_name") : CSTR2SYM("each"); | |
- return rb_funcall(self, rb_intern("to_enum"), 2, symbol, rb_pattern); | |
- } | |
- | |
if (!NIL_P(rb_pattern)) { | |
Check_Type(rb_pattern, T_STRING); | |
pattern = StringValueCStr(rb_pattern); | |
diff --git a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_tree.c b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_tree.c | |
index 3fab8f367..6bf3b3e96 100644 | |
--- a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_tree.c | |
+++ b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_tree.c | |
@@ -220,10 +220,9 @@ static VALUE rb_git_tree_each(VALUE self) | |
{ | |
git_tree *tree; | |
size_t i, count; | |
- Data_Get_Struct(self, git_tree, tree); | |
- if (!rb_block_given_p()) | |
- return rb_funcall(self, rb_intern("to_enum"), 0); | |
+ RETURN_ENUMERATOR(self, 0, 0); | |
+ Data_Get_Struct(self, git_tree, tree); | |
count = git_tree_entrycount(tree); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment