]> git.notmuchmail.org Git - notmuch/commitdiff
ruby: add tags helper
authorFelipe Contreras <felipe.contreras@gmail.com>
Wed, 22 Mar 2023 23:43:44 +0000 (17:43 -0600)
committerDavid Bremner <david@tethera.net>
Sun, 2 Apr 2023 22:00:49 +0000 (19:00 -0300)
Right now it doesn't do much, but it will help for further
reorganization.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
bindings/ruby/database.c
bindings/ruby/defs.h
bindings/ruby/message.c
bindings/ruby/messages.c
bindings/ruby/tags.c
bindings/ruby/thread.c

index b6de1254a5de30c23f3f3b30da1338e7ce275ebc..e6387f5990af41c56df5b2311f1af44c79cf88de 100644 (file)
@@ -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);
 }
 
 /*
index e2541e8f8de30f6c828be3edbde0699d57760dcc..9454658b96bd28fe08105afa4b464ad9492bb953 100644 (file)
@@ -369,6 +369,9 @@ VALUE
 notmuch_rb_message_thaw (VALUE self);
 
 /* tags.c */
+VALUE
+notmuch_rb_tags_get (notmuch_tags_t *tags);
+
 VALUE
 notmuch_rb_tags_destroy (VALUE self);
 
index f45c95cc5051d8475920c5a59bf07706e829e0be..81085f754648b5e650bd5fc51ceefee9bfef58bd 100644 (file)
@@ -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);
 }
 
 /*
index ca5b10d04b09702629eddbeb1eb217bef84a4274..6369d0523008b6dadda38bc58cde3c8c908badf5 100644 (file)
@@ -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);
 }
index 2af85e36598220f1cb93e806a8080ed2c3a3b862..cc6ea59ece07ca5aacfebc8d776f28c54b593992 100644 (file)
 
 #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
  *
index 7cb2a3dcc6ebeacdd5c4c37b726a53056c436a5c..b20ed89376f802626d5cb4b0d847b020c18de196 100644 (file)
@@ -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);
 }