unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: notmuch@notmuchmail.org
Cc: arcnmx <arcnmx@gmail.com>
Subject: [PATCH 1/3] ruby: add tags helper
Date: Wed, 22 Mar 2023 17:43:44 -0600	[thread overview]
Message-ID: <20230322234346.70537-2-felipe.contreras@gmail.com> (raw)
In-Reply-To: <20230322234346.70537-1-felipe.contreras@gmail.com>

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 | 2 +-
 bindings/ruby/defs.h     | 3 +++
 bindings/ruby/message.c  | 2 +-
 bindings/ruby/messages.c | 2 +-
 bindings/ruby/tags.c     | 6 ++++++
 bindings/ruby/thread.c   | 2 +-
 6 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c
index 9c3dbd96..9cac6005 100644
--- a/bindings/ruby/database.c
+++ b/bindings/ruby/database.c
@@ -408,7 +408,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
@@ -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);
 
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);
 }
-- 
2.39.2.13.g1fb56cf030

  reply	other threads:[~2023-03-22 23:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 23:43 [PATCH 0/3] ruby: get rid of Tags object Felipe Contreras
2023-03-22 23:43 ` Felipe Contreras [this message]
2023-03-22 23:43 ` [PATCH 2/3] ruby: tags: return string array directly Felipe Contreras
2023-03-22 23:43 ` [PATCH 3/3] ruby: remove Tags object Felipe Contreras
2023-04-02 22:18 ` [PATCH 0/3] ruby: get rid of " David Bremner
2023-04-02 23:06   ` Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230322234346.70537-2-felipe.contreras@gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=arcnmx@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).