mirror of
https://git.notmuchmail.org/git/notmuch
synced 2025-04-06 23:59:10 +02:00
ruby: fix "undefining the allocator of T_DATA" warnings
Ruby 3.2 introduced a warning when C-extensions use structs without redefining the allocation default allocation routine meant for objects. See https://bugs.ruby-lang.org/issues/18007 for details. In the Ruby bindings this happens at `Data_Wrap_Notmuch_Object` call sites, so the object types used there needed to update their allocation. This ruby code (given a database at the hardcoded path with messages matching `tag:tmp`) exercise all the ruby objects: require 'notmuch' Notmuch::Database.open File.expand_path("~/mail") do |db| db.get_directory("/tmp") db.query("tag:tmp").search_threads.each do |t| t.messages.each do |m| puts m.header("Subject") end end end Before these changes with ruby 3.2.5 and notmuch 0.38.3 it outputs: notmuch.rb:5: warning: undefining the allocator of T_DATA class Notmuch::Query notmuch.rb:5: warning: undefining the allocator of T_DATA class Notmuch::Threads notmuch.rb:5: warning: undefining the allocator of T_DATA class Notmuch::Thread notmuch.rb:6: warning: undefining the allocator of T_DATA class Notmuch::Messages notmuch.rb:6: warning: undefining the allocator of T_DATA class Notmuch::Message notmuch release 0.38.3 now available (the last line is the message I tagged with tmp), and after the changes: notmuch release 0.38.3 now available
This commit is contained in:
parent
53cbb6d0cb
commit
e8261872dc
1 changed files with 5 additions and 0 deletions
|
@ -293,6 +293,7 @@ Init_notmuch (void)
|
|||
* Notmuch query
|
||||
*/
|
||||
notmuch_rb_cQuery = rb_define_class_under (mod, "Query", rb_cObject);
|
||||
rb_undef_alloc_func(notmuch_rb_cQuery);
|
||||
rb_undef_method (notmuch_rb_cQuery, "initialize");
|
||||
rb_define_method (notmuch_rb_cQuery, "destroy!", notmuch_rb_query_destroy, 0); /* in query.c */
|
||||
rb_define_method (notmuch_rb_cQuery, "sort", notmuch_rb_query_get_sort, 0); /* in query.c */
|
||||
|
@ -311,6 +312,7 @@ Init_notmuch (void)
|
|||
* Notmuch threads
|
||||
*/
|
||||
notmuch_rb_cThreads = rb_define_class_under (mod, "Threads", rb_cObject);
|
||||
rb_undef_alloc_func(notmuch_rb_cThreads);
|
||||
rb_undef_method (notmuch_rb_cThreads, "initialize");
|
||||
rb_define_method (notmuch_rb_cThreads, "destroy!", notmuch_rb_threads_destroy, 0); /* in threads.c */
|
||||
rb_define_method (notmuch_rb_cThreads, "each", notmuch_rb_threads_each, 0); /* in threads.c */
|
||||
|
@ -322,6 +324,7 @@ Init_notmuch (void)
|
|||
* Notmuch messages
|
||||
*/
|
||||
notmuch_rb_cMessages = rb_define_class_under (mod, "Messages", rb_cObject);
|
||||
rb_undef_alloc_func(notmuch_rb_cMessages);
|
||||
rb_undef_method (notmuch_rb_cMessages, "initialize");
|
||||
rb_define_method (notmuch_rb_cMessages, "destroy!", notmuch_rb_messages_destroy, 0); /* in messages.c */
|
||||
rb_define_method (notmuch_rb_cMessages, "each", notmuch_rb_messages_each, 0); /* in messages.c */
|
||||
|
@ -334,6 +337,7 @@ Init_notmuch (void)
|
|||
* Notmuch thread
|
||||
*/
|
||||
notmuch_rb_cThread = rb_define_class_under (mod, "Thread", rb_cObject);
|
||||
rb_undef_alloc_func(notmuch_rb_cThread);
|
||||
rb_undef_method (notmuch_rb_cThread, "initialize");
|
||||
rb_define_method (notmuch_rb_cThread, "destroy!", notmuch_rb_thread_destroy, 0); /* in thread.c */
|
||||
rb_define_method (notmuch_rb_cThread, "thread_id", notmuch_rb_thread_get_thread_id, 0); /* in thread.c */
|
||||
|
@ -353,6 +357,7 @@ Init_notmuch (void)
|
|||
* Notmuch message
|
||||
*/
|
||||
notmuch_rb_cMessage = rb_define_class_under (mod, "Message", rb_cObject);
|
||||
rb_undef_alloc_func(notmuch_rb_cMessage);
|
||||
rb_undef_method (notmuch_rb_cMessage, "initialize");
|
||||
rb_define_method (notmuch_rb_cMessage, "destroy!", notmuch_rb_message_destroy, 0); /* in message.c */
|
||||
rb_define_method (notmuch_rb_cMessage, "message_id", notmuch_rb_message_get_message_id, 0); /* in message.c */
|
||||
|
|
Loading…
Add table
Reference in a new issue