@@ -17,10 +17,6 @@ VALUE opt_onek, opt_onebil, opt_float_zero, opt_four, opt_tenk;
17
17
18
18
// Lib Macros
19
19
20
- #define GET_CLIENT_WRAPPER (self ) \
21
- tinytds_client_wrapper *cwrap; \
22
- Data_Get_Struct(self, tinytds_client_wrapper, cwrap)
23
-
24
20
#ifdef _WIN32
25
21
#define LONG_LONG_FORMAT "I64d"
26
22
#else
@@ -395,10 +391,30 @@ static void rb_tinytds_client_free(void *ptr) {
395
391
xfree (ptr );
396
392
}
397
393
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
+
398
414
static VALUE allocate (VALUE klass ) {
399
415
VALUE obj ;
400
416
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 );
402
418
cwrap -> closed = 1 ;
403
419
cwrap -> charset = Qnil ;
404
420
cwrap -> userdata = malloc (sizeof (tinytds_client_userdata ));
0 commit comments