ruby: fix deprecation warnings

Convert to TypedData_Get_Struct which has been in ruby since 2009

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson
2025-10-20 12:41:55 -04:00
parent a497a24ecf
commit 967587b061
2 changed files with 17 additions and 6 deletions

View File

@@ -76,6 +76,8 @@ extern VALUE m_guestfs; /* guestfs module */
extern VALUE c_guestfs; /* guestfs_h handle */
extern VALUE e_Error; /* used for all errors */
extern const rb_data_type_t guestfs_h_data_type; /* TypedData structure */
extern VALUE guestfs_int_ruby_alloc_handle (VALUE klass);
extern VALUE guestfs_int_ruby_initialize_handle (int argc, VALUE *argv, VALUE m);
extern VALUE guestfs_int_ruby_compat_create_handle (int argc, VALUE *argv, VALUE module);
@@ -224,7 +226,7 @@ and generate_ruby_c actions () =
pr ")\n";
pr "{\n";
pr " guestfs_h *g;\n";
pr " Data_Get_Struct (gv, guestfs_h, g);\n";
pr " TypedData_Get_Struct (gv, guestfs_h, &guestfs_h_data_type, g);\n";
pr " if (!g)\n";
pr " rb_raise (rb_eArgError, \"%%s: used handle after closing it\", \"%s\");\n"
f.name;