]> git.cworth.org Git - notmuch/commitdiff
ruby: improve general data get helper
authorFelipe Contreras <felipe.contreras@gmail.com>
Tue, 4 May 2021 08:17:42 +0000 (03:17 -0500)
committerDavid Bremner <david@tethera.net>
Wed, 12 May 2021 22:13:31 +0000 (19:13 -0300)
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

index e95ea239b0cea8c222c71e72d6b225f75f371641..46e2caf8a0ee54fbb08b4fbb9c850853e95a4809 100644 (file)
@@ -57,10 +57,9 @@ extern ID ID_db_mode;
 
 #define Data_Get_Notmuch_Object(obj, type, message, ptr)       \
     do {                                                       \
 
 #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));                   \
        Data_Get_Struct ((obj), type, (ptr));                   \
+       if (!(ptr))                                             \
+       rb_raise (rb_eRuntimeError, (message));                 \
     } while (0)
 
 #define Data_Get_Notmuch_Database(obj, ptr) \
     } while (0)
 
 #define Data_Get_Notmuch_Database(obj, ptr) \