<feed xmlns='http://www.w3.org/2005/Atom'>
<title>notmuch/bindings/ruby/init.c, branch debian/0.39_rc3-1</title>
<subtitle>thread-based email index, search, and tagging</subtitle>
<id>https://git.notmuchmail.org/git/notmuch/atom?h=debian%2F0.39_rc3-1</id>
<link rel='self' href='https://git.notmuchmail.org/git/notmuch/atom?h=debian%2F0.39_rc3-1'/>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/'/>
<updated>2025-03-08T14:39:22Z</updated>
<entry>
<title>ruby: fix "undefining the allocator of T_DATA" warnings</title>
<updated>2025-03-08T14:39:22Z</updated>
<author>
<name>Johannes Larsen</name>
<email>mail@johslarsen.net</email>
</author>
<published>2024-09-01T00:02:10Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=e8261872dc65ea0259971ff44721a2f7d3f34e67'/>
<id>urn:sha1:e8261872dc65ea0259971ff44721a2f7d3f34e67</id>
<content type='text'>
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
</content>
</entry>
<entry>
<title>ruby: db: reorganize initializer</title>
<updated>2023-05-29T10:51:02Z</updated>
<author>
<name>Felipe Contreras</name>
<email>felipe.contreras@gmail.com</email>
</author>
<published>2023-03-31T20:40:50Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=95a4bf38173311597bcc4fa7f597d58bb11ed119'/>
<id>urn:sha1:95a4bf38173311597bcc4fa7f597d58bb11ed119</id>
<content type='text'>
In order to make it more extensible.

No functional changes.

Signed-off-by: Felipe Contreras &lt;felipe.contreras@gmail.com&gt;
</content>
</entry>
<entry>
<title>ruby: remove FileNames object</title>
<updated>2023-04-12T10:30:01Z</updated>
<author>
<name>Felipe Contreras</name>
<email>felipe.contreras@gmail.com</email>
</author>
<published>2023-03-27T21:59:42Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=e4d75fcc8349ae95ec22d0e6679880d23bed37f8'/>
<id>urn:sha1:e4d75fcc8349ae95ec22d0e6679880d23bed37f8</id>
<content type='text'>
Not used anymore now that we return an array of strings directly.

Signed-off-by: Felipe Contreras &lt;felipe.contreras@gmail.com&gt;
</content>
</entry>
<entry>
<title>ruby: remove Tags object</title>
<updated>2023-04-02T22:11:10Z</updated>
<author>
<name>Felipe Contreras</name>
<email>felipe.contreras@gmail.com</email>
</author>
<published>2023-03-22T23:43:46Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=44924a6a09659c97d6cde383bf7deac0413d07c3'/>
<id>urn:sha1:44924a6a09659c97d6cde383bf7deac0413d07c3</id>
<content type='text'>
Not used anymore now that we return an array of strings directly.

Signed-off-by: Felipe Contreras &lt;felipe.contreras@gmail.com&gt;
</content>
</entry>
<entry>
<title>ruby: split database close and destroy</title>
<updated>2021-08-02T16:49:29Z</updated>
<author>
<name>Felipe Contreras</name>
<email>felipe.contreras@gmail.com</email>
</author>
<published>2021-07-07T03:45:32Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=7415b53fa568a3156ae3e3a47544a4784e024653'/>
<id>urn:sha1:7415b53fa568a3156ae3e3a47544a4784e024653</id>
<content type='text'>
Mirrors the C API: 7864350c (Split notmuch_database_close into two
functions, 2012-04-25).

Signed-off-by: Felipe Contreras &lt;felipe.contreras@gmail.com&gt;
</content>
</entry>
<entry>
<title>ruby: create an actual wrapper struct</title>
<updated>2021-07-18T20:08:42Z</updated>
<author>
<name>Felipe Contreras</name>
<email>felipe.contreras@gmail.com</email>
</author>
<published>2021-05-17T19:39:14Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=02b162116079a0b2e35823e5590a82056d22c8af'/>
<id>urn:sha1:02b162116079a0b2e35823e5590a82056d22c8af</id>
<content type='text'>
Currently Ruby data points directly to a notmuch object (e.g.
notmuch_database_t), since we don't need any extra data that is fine.

However, in the next commit we will need extra data, therefore we create
a new struct notmuch_rb_object_t wrapper which contains nothing but a
pointer to the current pointer (e.g. notmuch_database_t).

This struct is tied to the Ruby object, and is freed when the Ruby
object is freed by the garbage collector.

We do nothing with this wrapper, so no functionality should be changed.

Signed-off-by: Felipe Contreras &lt;felipe.contreras@gmail.com&gt;
</content>
</entry>
<entry>
<title>ruby: add keyword arguments to db.query</title>
<updated>2021-06-27T17:13:03Z</updated>
<author>
<name>Felipe Contreras</name>
<email>felipe.contreras@gmail.com</email>
</author>
<published>2021-05-24T02:19:09Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=814abafc3e4280de115d4bc0ac01f8d026a0a7f9'/>
<id>urn:sha1:814abafc3e4280de115d4bc0ac01f8d026a0a7f9</id>
<content type='text'>
That way we don't need pass them to the query object ourselves.

Signed-off-by: Felipe Contreras &lt;felipe.contreras@gmail.com&gt;
</content>
</entry>
<entry>
<title>ruby: use notmuch_exclude_t enum</title>
<updated>2021-05-23T12:05:33Z</updated>
<author>
<name>Felipe Contreras</name>
<email>felipe.contreras@gmail.com</email>
</author>
<published>2021-05-01T12:04:46Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=85ae2bcf56021a22a803fbde34baa5050bbb28d9'/>
<id>urn:sha1:85ae2bcf56021a22a803fbde34baa5050bbb28d9</id>
<content type='text'>
It exists since 2013, let's allow it to be used in Ruby.

Signed-off-by: Felipe Contreras &lt;felipe.contreras@gmail.com&gt;
</content>
</entry>
<entry>
<title>ruby: new notmuch_rb_object_destroy() helper</title>
<updated>2021-05-17T10:25:14Z</updated>
<author>
<name>Felipe Contreras</name>
<email>felipe.contreras@gmail.com</email>
</author>
<published>2021-05-15T21:21:03Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=5f49e3421f5d1f98951b55dd5ba106c2a106aba7'/>
<id>urn:sha1:5f49e3421f5d1f98951b55dd5ba106c2a106aba7</id>
<content type='text'>
The struct used to store the types (rb_data_type_t) contains a "data"
field where we can store whatever we want. I use that field to store a
pointer to the corresponding destroy function. For example
notmuch_rb_database_type contains a pointer to notmuch_database_destroy.

I cast that pointer as a notmuch_status_t (func*)(void *) and call
that function passing the internal object (e.g. notmuch_database_t).

Using the rb_data_type_t data we can call the correct notmuch destroy
function.

Therefore this:

  ret = ((notmuch_status_t (*)(void *)) type-&gt;data) (nm_object);

Is effectively the same as this:

  ret = notmuch_database_destroy (database);

The advantage of doing it this way is that much less code is necesary
since each rb_data_type_t has the corresponding destroy function stored
in it.

Signed-off-by: Felipe Contreras &lt;felipe.contreras@gmail.com&gt;
</content>
</entry>
<entry>
<title>ruby: add all data types</title>
<updated>2021-05-17T10:25:14Z</updated>
<author>
<name>Felipe Contreras</name>
<email>felipe.contreras@gmail.com</email>
</author>
<published>2021-05-15T21:21:02Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=9574fb60991fa81799fbd1d26d41693ca2794e6b'/>
<id>urn:sha1:9574fb60991fa81799fbd1d26d41693ca2794e6b</id>
<content type='text'>
Signed-off-by: Felipe Contreras &lt;felipe.contreras@gmail.com&gt;
</content>
</entry>
</feed>
