[PATCH 2/3] ruby: improve general data get helper

Subject: [PATCH 2/3] ruby: improve general data get helper

Date: Mon, 3 May 2021 02:54:56 -0500

To: notmuch@notmuchmail.org

Cc: Ali Polatel

From: Felipe Contreras


There's no need to do Check_Type, Data_Get_Struct calls
rb_data_object_get(), which already does that.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 bindings/ruby/defs.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h
index e95ea239..46e2caf8 100644
--- a/bindings/ruby/defs.h
+++ b/bindings/ruby/defs.h
@@ -57,10 +57,9 @@ extern ID ID_db_mode;
 
 #define Data_Get_Notmuch_Object(obj, type, message, ptr)	\
     do {							\
-	Check_Type ((obj), T_DATA);				\
-	if (DATA_PTR ((obj)) == NULL)				\
-	rb_raise (rb_eRuntimeError, (message));			\
 	Data_Get_Struct ((obj), type, (ptr));			\
+	if (!(ptr))						\
+	rb_raise (rb_eRuntimeError, (message));			\
     } while (0)
 
 #define Data_Get_Notmuch_Database(obj, ptr) \
-- 
2.31.0
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: