@@ -17,10 +17,6 @@ VALUE opt_onek, opt_onebil, opt_float_zero, opt_four, opt_tenk;
1717
1818// Lib Macros
1919
20- #define GET_CLIENT_WRAPPER (self ) \
21- tinytds_client_wrapper *cwrap; \
22- Data_Get_Struct(self, tinytds_client_wrapper, cwrap)
23-
2420#ifdef _WIN32
2521 #define LONG_LONG_FORMAT "I64d"
2622#else
@@ -395,10 +391,30 @@ static void rb_tinytds_client_free(void *ptr) {
395391 xfree (ptr );
396392}
397393
394+ size_t rb_tinytds_client_size (const void * data )
395+ {
396+ return sizeof (tinytds_client_wrapper );
397+ }
398+
399+ static const rb_data_type_t tinytds_client_wrapper_type = {
400+ .wrap_struct_name = "tinytds_client_wrapper" ,
401+ .function = {
402+ .dmark = rb_tinytds_client_mark ,
403+ .dfree = rb_tinytds_client_free ,
404+ .dsize = rb_tinytds_client_size ,
405+ },
406+ .data = NULL ,
407+ .flags = RUBY_TYPED_FREE_IMMEDIATELY ,
408+ };
409+
410+ #define GET_CLIENT_WRAPPER (self ) \
411+ tinytds_client_wrapper *cwrap; \
412+ TypedData_Get_Struct(self, tinytds_client_wrapper, &tinytds_client_wrapper_type, cwrap);
413+
398414static VALUE allocate (VALUE klass ) {
399415 VALUE obj ;
400416 tinytds_client_wrapper * cwrap ;
401- obj = Data_Make_Struct (klass , tinytds_client_wrapper , rb_tinytds_client_mark , rb_tinytds_client_free , cwrap );
417+ obj = TypedData_Make_Struct (klass , tinytds_client_wrapper , & tinytds_client_wrapper_type , cwrap );
402418 cwrap -> closed = 1 ;
403419 cwrap -> charset = Qnil ;
404420 cwrap -> userdata = malloc (sizeof (tinytds_client_userdata ));
0 commit comments