Skip to content

Commit

Permalink
Use rb_intern_const instead of rb_intern in Init functions
Browse files Browse the repository at this point in the history
[ This is a backport to the 2.2 branch. ]

```
find . -name \*.o -exec nm {} + |&
sed '/Init_.*\.rbimpl_id/!d;s/^.* b //;s/\.[1-9][0-9]*$//;s/\.rbimpl_id$//' |
uniq
```
should be empty.

(cherry picked from commit 9e4d470)
  • Loading branch information
nobu authored and rhenium committed Oct 16, 2021
1 parent a26e600 commit 5443723
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions ext/openssl/ossl_ts.c
Expand Up @@ -1257,24 +1257,24 @@ Init_ossl_ts(void)
* timestamp server rejects the message imprint algorithm used in the
* +Request+
*/
sBAD_ALG = rb_intern("BAD_ALG");
sBAD_ALG = rb_intern_const("BAD_ALG");

/*
* Possible return value for +Response#failure_info+. Indicates that the
* timestamp server was not able to process the +Request+ properly.
*/
sBAD_REQUEST = rb_intern("BAD_REQUEST");
sBAD_REQUEST = rb_intern_const("BAD_REQUEST");
/*
* Possible return value for +Response#failure_info+. Indicates that the
* timestamp server was not able to parse certain data in the +Request+.
*/
sBAD_DATA_FORMAT = rb_intern("BAD_DATA_FORMAT");
sBAD_DATA_FORMAT = rb_intern_const("BAD_DATA_FORMAT");

sTIME_NOT_AVAILABLE = rb_intern("TIME_NOT_AVAILABLE");
sUNACCEPTED_POLICY = rb_intern("UNACCEPTED_POLICY");
sUNACCEPTED_EXTENSION = rb_intern("UNACCEPTED_EXTENSION");
sADD_INFO_NOT_AVAILABLE = rb_intern("ADD_INFO_NOT_AVAILABLE");
sSYSTEM_FAILURE = rb_intern("SYSTEM_FAILURE");
sTIME_NOT_AVAILABLE = rb_intern_const("TIME_NOT_AVAILABLE");
sUNACCEPTED_POLICY = rb_intern_const("UNACCEPTED_POLICY");
sUNACCEPTED_EXTENSION = rb_intern_const("UNACCEPTED_EXTENSION");
sADD_INFO_NOT_AVAILABLE = rb_intern_const("ADD_INFO_NOT_AVAILABLE");
sSYSTEM_FAILURE = rb_intern_const("SYSTEM_FAILURE");

/* Document-class: OpenSSL::Timestamp
* Provides classes and methods to request, create and validate
Expand Down Expand Up @@ -1513,11 +1513,11 @@ Init_ossl_ts(void)
*
*/
cTimestampFactory = rb_define_class_under(mTimestamp, "Factory", rb_cObject);
rb_attr(cTimestampFactory, rb_intern("allowed_digests"), 1, 1, 0);
rb_attr(cTimestampFactory, rb_intern("default_policy_id"), 1, 1, 0);
rb_attr(cTimestampFactory, rb_intern("serial_number"), 1, 1, 0);
rb_attr(cTimestampFactory, rb_intern("gen_time"), 1, 1, 0);
rb_attr(cTimestampFactory, rb_intern("additional_certs"), 1, 1, 0);
rb_attr(cTimestampFactory, rb_intern_const("allowed_digests"), 1, 1, 0);
rb_attr(cTimestampFactory, rb_intern_const("default_policy_id"), 1, 1, 0);
rb_attr(cTimestampFactory, rb_intern_const("serial_number"), 1, 1, 0);
rb_attr(cTimestampFactory, rb_intern_const("gen_time"), 1, 1, 0);
rb_attr(cTimestampFactory, rb_intern_const("additional_certs"), 1, 1, 0);
rb_define_method(cTimestampFactory, "create_timestamp", ossl_tsfac_create_ts, 3);
}

Expand Down

0 comments on commit 5443723

Please sign in to comment.