Skip to content

Commit

Permalink
Use rb_block_call() instead of the deprecated rb_iterate() in OpenSSL
Browse files Browse the repository at this point in the history
* See https://bugs.ruby-lang.org/issues/18025
  and ruby/ruby#4629

This is a backport to the 2.1 branch.

(cherry picked from commit b8e4852)
  • Loading branch information
eregon authored and rhenium committed Sep 1, 2021
1 parent fef83a1 commit b0f7f59
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ext/openssl/ossl_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static VALUE eSSLErrorWaitReadable;
static VALUE eSSLErrorWaitWritable;

static ID id_call, ID_callback_state, id_tmp_dh_callback, id_tmp_ecdh_callback,
id_npn_protocols_encoded;
id_npn_protocols_encoded, id_each;
static VALUE sym_exception, sym_wait_readable, sym_wait_writable;

static ID id_i_cert_store, id_i_ca_file, id_i_ca_path, id_i_verify_mode,
Expand Down Expand Up @@ -614,7 +614,7 @@ static VALUE
ssl_encode_npn_protocols(VALUE protocols)
{
VALUE encoded = rb_str_new(NULL, 0);
rb_iterate(rb_each, protocols, ssl_npn_encode_protocol_i, encoded);
rb_block_call(protocols, id_each, 0, 0, ssl_npn_encode_protocol_i, encoded);
return encoded;
}

Expand Down Expand Up @@ -2957,6 +2957,7 @@ Init_ossl_ssl(void)
id_tmp_dh_callback = rb_intern("tmp_dh_callback");
id_tmp_ecdh_callback = rb_intern("tmp_ecdh_callback");
id_npn_protocols_encoded = rb_intern("npn_protocols_encoded");
id_each = rb_intern_const("each");

#define DefIVarID(name) do \
id_i_##name = rb_intern("@"#name); while (0)
Expand Down

0 comments on commit b0f7f59

Please sign in to comment.