kpumuk commented on code in PR #3691:
URL: https://github.com/apache/thrift/pull/3691#discussion_r3694130834
##########
lib/rb/ext/struct.c:
##########
@@ -771,17 +820,26 @@ static VALUE rb_thrift_union_write(VALUE self, VALUE
protocol) {
return Qnil;
}
+// cppcheck-suppress constParameterCallback
+static VALUE rb_thrift_union_write(int argc, VALUE *argv, VALUE self) {
+ VALUE protocol;
+ int remaining_depth = parse_recursive_args(argc, argv, &protocol);
+ return rb_thrift_union_write_recursive(self, protocol, remaining_depth);
+}
+
void Init_struct(void) {
VALUE struct_module = rb_const_get(thrift_module, rb_intern("Struct"));
- rb_define_method(struct_module, "write", rb_thrift_struct_write, 1);
- rb_define_method(struct_module, "read", rb_thrift_struct_read, 1);
+ recursion_limit = FIX2INT(rb_const_get(thrift_module,
rb_intern("DEFAULT_RECURSION_DEPTH")));
Review Comment:
`thrift_native` is not a standalone entry point and already requires the
Ruby runtime classes and constants to be initialized. Directly requiring it
fails at the pre-existing `Thrift` lookup before reaching `Init_struct`. Both
supported load paths load `thrift/exceptions`, which defines
`DEFAULT_RECURSION_DEPTH`, before the extension. A C fallback would therefore
duplicate the default without enabling independent loading.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]