Skip to content

Commit 1615628

Browse files
committed
Move rb_global_variable call to directly after assignment
While I'm guessing the INT2NUM calls all generate Fixnums and not Bignums, it's unwise to rely on that. Calling rb_global_variable directly after assignment is the pattern used in ossl.c, and it's probably best to do that here as well.
1 parent fdcda97 commit 1615628

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/openssl/ossl_asn1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1823,6 +1823,7 @@ do{\
18231823
rb_define_method(cASN1EndOfContent, "to_der", ossl_asn1eoc_to_der, 0);
18241824

18251825
class_tag_map = rb_hash_new();
1826+
rb_global_variable(&class_tag_map);
18261827
rb_hash_aset(class_tag_map, cASN1EndOfContent, INT2NUM(V_ASN1_EOC));
18271828
rb_hash_aset(class_tag_map, cASN1Boolean, INT2NUM(V_ASN1_BOOLEAN));
18281829
rb_hash_aset(class_tag_map, cASN1Integer, INT2NUM(V_ASN1_INTEGER));
@@ -1846,7 +1847,6 @@ do{\
18461847
rb_hash_aset(class_tag_map, cASN1GeneralString, INT2NUM(V_ASN1_GENERALSTRING));
18471848
rb_hash_aset(class_tag_map, cASN1UniversalString, INT2NUM(V_ASN1_UNIVERSALSTRING));
18481849
rb_hash_aset(class_tag_map, cASN1BMPString, INT2NUM(V_ASN1_BMPSTRING));
1849-
rb_global_variable(&class_tag_map);
18501850

18511851
id_each = rb_intern_const("each");
18521852
}

0 commit comments

Comments
 (0)