commit 1db8ae8d06ce906ddd8b3910782897084eb5cdcc
parent 8d9697dfb876a0d3c37c5ff0b1ad327808b57c6c
Author: Dan Callaghan <djc@djc.id.au>
Date: Sun, 7 Apr 2024 13:00:15 +1000
undefine the allocator function for custom classes
See: https://bugs.ruby-lang.org/issues/18007
Fixes warnings like this:
warning: undefining the allocator of T_DATA class Ncurses::Form::FIELD
warning: undefining the allocator of T_DATA class Ncurses::Form::FORM
Diffstat:
4 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/form_wrap.c b/form_wrap.c
@@ -1367,6 +1367,7 @@ void init_form(void)
/* Forms */
rb_iv_set(mForm, "@forms_hash", rb_hash_new());
cFORM = rb_define_class_under(mForm, "FORM", rb_cObject);
+ rb_undef_alloc_func(cFORM);
rb_define_singleton_method(cFORM, "new",
(&rbncurs_m_new_form),
1);
@@ -1413,6 +1414,7 @@ void init_form(void)
/* Fields */
rb_iv_set(mForm, "@fields_hash", rb_hash_new());
cFIELD = rb_define_class_under(mForm, "FIELD", rb_cObject);
+ rb_undef_alloc_func(cFIELD);
rb_define_singleton_method(cFIELD, "new",
(&rbncurs_m_new_field),
6);
@@ -1454,6 +1456,7 @@ void init_form(void)
/* Field types */
rb_iv_set(mForm, "@fieldtypes_hash", rb_hash_new());
cFIELDTYPE = rb_define_class_under(mForm, "FIELDTYPE", rb_cObject);
+ rb_undef_alloc_func(cFIELDTYPE);
rb_define_singleton_method(cFIELDTYPE, "new",
(&rbncurs_m_new_fieldtype),
2);
diff --git a/menu_wrap.c b/menu_wrap.c
@@ -1074,6 +1074,7 @@ void init_menu(void)
/* Menus */
rb_iv_set(mMenu, "@menus_hash", rb_hash_new());
cMENU = rb_define_class_under(mMenu, "MENU", rb_cObject);
+ rb_undef_alloc_func(cMENU);
rb_define_singleton_method(cMENU, "new", (&rbncurs_m_new_menu), 1);
RB_CLASS_METH(cMENU, NULL, current_item, 0);
@@ -1127,6 +1128,7 @@ void init_menu(void)
/* Items */
rb_iv_set(mMenu, "@items_hash", rb_hash_new());
cITEM = rb_define_class_under(mMenu, "ITEM", rb_cObject);
+ rb_undef_alloc_func(cITEM);
rb_define_singleton_method(cITEM, "new", (&rbncurs_m_new_item), 2);
RB_CLASS_METH(cITEM, "free", free_item, 0);
diff --git a/ncurses_wrap.c b/ncurses_wrap.c
@@ -2865,7 +2865,9 @@ void Init_ncursesw_bin(void)
rb_iv_set(mNcurses, "@infd", Qnil);
cWINDOW = rb_define_class_under(mNcurses, "WINDOW", rb_cObject);
+ rb_undef_alloc_func(cWINDOW);
cSCREEN = rb_define_class_under(mNcurses, "SCREEN", rb_cObject);
+ rb_undef_alloc_func(cSCREEN);
init_constants_1();
init_constants_2();
init_constants_3();
diff --git a/panel_wrap.c b/panel_wrap.c
@@ -135,6 +135,7 @@ void init_panel(void)
mPanel = rb_define_module_under(mNcurses, "Panel");
rb_iv_set(mPanel, "@panels_hash", rb_hash_new());
cPANEL = rb_define_class_under(mPanel, "PANEL", rb_cObject);
+ rb_undef_alloc_func(cPANEL);
rb_define_singleton_method(mPanel, "del_panel",
(&rbncurs_m_del_panel),
1);