Skip to content

Commit 02872d3

Browse files
committed
ossl.c: add helper function ossl_want_uninitialized()
1 parent f62cc13 commit 02872d3

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

ext/openssl/ossl.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,16 @@ VALUE mOSSL;
231231
*/
232232
VALUE eOSSLError;
233233

234+
void
235+
ossl_want_uninitialized(VALUE self, const rb_data_type_t *type)
236+
{
237+
if (rb_check_typeddata(self, type)) {
238+
rb_raise(rb_eTypeError, "%"PRIsVALUE" already initialized",
239+
rb_obj_class(self));
240+
}
241+
rb_check_frozen(self);
242+
}
243+
234244
/*
235245
* Convert to DER string
236246
*/

ext/openssl/ossl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ extern VALUE eOSSLError;
9292
}\
9393
} while (0)
9494

95+
void ossl_want_uninitialized(VALUE self, const rb_data_type_t *type);
96+
9597
/*
9698
* Type conversions
9799
*/

0 commit comments

Comments
 (0)