From 777b02a7d7b922bcae08af1c16e475051ec7d8f3 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Mon, 27 Mar 2023 15:59:40 -0600 Subject: [PATCH] ruby: add filenames helper Right now it doesn't do much, but it will help for further reorganization. Signed-off-by: Felipe Contreras --- bindings/ruby/defs.h | 3 +++ bindings/ruby/directory.c | 4 ++-- bindings/ruby/filenames.c | 6 ++++++ bindings/ruby/message.c | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h index 027408a1..97aea25d 100644 --- a/bindings/ruby/defs.h +++ b/bindings/ruby/defs.h @@ -224,6 +224,9 @@ VALUE notmuch_rb_directory_get_child_directories (VALUE self); /* filenames.c */ +VALUE +notmuch_rb_filenames_get (notmuch_filenames_t *fnames); + VALUE notmuch_rb_filenames_destroy (VALUE self); diff --git a/bindings/ruby/directory.c b/bindings/ruby/directory.c index 910f0a99..f267d82f 100644 --- a/bindings/ruby/directory.c +++ b/bindings/ruby/directory.c @@ -87,7 +87,7 @@ notmuch_rb_directory_get_child_files (VALUE self) fnames = notmuch_directory_get_child_files (dir); - return Data_Wrap_Notmuch_Object (notmuch_rb_cFileNames, ¬much_rb_filenames_type, fnames); + return notmuch_rb_filenames_get (fnames); } /* @@ -106,5 +106,5 @@ notmuch_rb_directory_get_child_directories (VALUE self) fnames = notmuch_directory_get_child_directories (dir); - return Data_Wrap_Notmuch_Object (notmuch_rb_cFileNames, ¬much_rb_filenames_type, fnames); + return notmuch_rb_filenames_get (fnames); } diff --git a/bindings/ruby/filenames.c b/bindings/ruby/filenames.c index 0dec1952..17873393 100644 --- a/bindings/ruby/filenames.c +++ b/bindings/ruby/filenames.c @@ -20,6 +20,12 @@ #include "defs.h" +VALUE +notmuch_rb_filenames_get (notmuch_filenames_t *fnames) +{ + return Data_Wrap_Notmuch_Object (notmuch_rb_cFileNames, ¬much_rb_filenames_type, fnames); +} + /* * call-seq: FILENAMES.destroy! => nil * diff --git a/bindings/ruby/message.c b/bindings/ruby/message.c index 81085f75..13c182f6 100644 --- a/bindings/ruby/message.c +++ b/bindings/ruby/message.c @@ -120,7 +120,7 @@ notmuch_rb_message_get_filenames (VALUE self) fnames = notmuch_message_get_filenames (message); - return Data_Wrap_Notmuch_Object (notmuch_rb_cFileNames, ¬much_rb_filenames_type, fnames); + return notmuch_rb_filenames_get (fnames); } /*