aboutsummaryrefslogtreecommitdiff
path: root/bindings
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2023-03-22 17:43:44 -0600
committerDavid Bremner <david@tethera.net>2023-04-02 19:00:49 -0300
commitae1336dea5cc6a221699fff260d8b44cee677f77 (patch)
treec4648b41e7d193c35d2c643ae006dbb7befcaff3 /bindings
parent6273966d0b50541a37a652ccf6113f184eff5300 (diff)
ruby: add tags helper
Right now it doesn't do much, but it will help for further reorganization. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Diffstat (limited to 'bindings')
-rw-r--r--bindings/ruby/database.c2
-rw-r--r--bindings/ruby/defs.h3
-rw-r--r--bindings/ruby/message.c2
-rw-r--r--bindings/ruby/messages.c2
-rw-r--r--bindings/ruby/tags.c6
-rw-r--r--bindings/ruby/thread.c2
6 files changed, 13 insertions, 4 deletions
diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c
index b6de1254..e6387f59 100644
--- a/bindings/ruby/database.c
+++ b/bindings/ruby/database.c
@@ -412,7 +412,7 @@ notmuch_rb_database_get_all_tags (VALUE self)
rb_raise (notmuch_rb_eBaseError, "%s", msg);
}
- return Data_Wrap_Notmuch_Object (notmuch_rb_cTags, &notmuch_rb_tags_type, tags);
+ return notmuch_rb_tags_get (tags);
}
/*
diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h
index e2541e8f..9454658b 100644
--- a/bindings/ruby/defs.h
+++ b/bindings/ruby/defs.h
@@ -370,6 +370,9 @@ notmuch_rb_message_thaw (VALUE self);
/* tags.c */
VALUE
+notmuch_rb_tags_get (notmuch_tags_t *tags);
+
+VALUE
notmuch_rb_tags_destroy (VALUE self);
VALUE
diff --git a/bindings/ruby/message.c b/bindings/ruby/message.c
index f45c95cc..81085f75 100644
--- a/bindings/ruby/message.c
+++ b/bindings/ruby/message.c
@@ -221,7 +221,7 @@ notmuch_rb_message_get_tags (VALUE self)
if (!tags)
rb_raise (notmuch_rb_eMemoryError, "Out of memory");
- return Data_Wrap_Notmuch_Object (notmuch_rb_cTags, &notmuch_rb_tags_type, tags);
+ return notmuch_rb_tags_get (tags);
}
/*
diff --git a/bindings/ruby/messages.c b/bindings/ruby/messages.c
index ca5b10d0..6369d052 100644
--- a/bindings/ruby/messages.c
+++ b/bindings/ruby/messages.c
@@ -71,5 +71,5 @@ notmuch_rb_messages_collect_tags (VALUE self)
if (!tags)
rb_raise (notmuch_rb_eMemoryError, "Out of memory");
- return Data_Wrap_Notmuch_Object (notmuch_rb_cTags, &notmuch_rb_tags_type, tags);
+ return notmuch_rb_tags_get (tags);
}
diff --git a/bindings/ruby/tags.c b/bindings/ruby/tags.c
index 2af85e36..cc6ea59e 100644
--- a/bindings/ruby/tags.c
+++ b/bindings/ruby/tags.c
@@ -20,6 +20,12 @@
#include "defs.h"
+VALUE
+notmuch_rb_tags_get (notmuch_tags_t *tags)
+{
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cTags, &notmuch_rb_tags_type, tags);
+}
+
/*
* call-seq: TAGS.destroy! => nil
*
diff --git a/bindings/ruby/thread.c b/bindings/ruby/thread.c
index 7cb2a3dc..b20ed893 100644
--- a/bindings/ruby/thread.c
+++ b/bindings/ruby/thread.c
@@ -204,5 +204,5 @@ notmuch_rb_thread_get_tags (VALUE self)
if (!tags)
rb_raise (notmuch_rb_eMemoryError, "Out of memory");
- return Data_Wrap_Notmuch_Object (notmuch_rb_cTags, &notmuch_rb_tags_type, tags);
+ return notmuch_rb_tags_get (tags);
}