aboutsummaryrefslogtreecommitdiff
path: root/bindings/ruby
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2021-05-04 03:17:42 -0500
committerDavid Bremner <david@tethera.net>2021-05-12 19:13:31 -0300
commita34d7b41444ad2fb50cc7def25659c88d439780a (patch)
tree46696d0cb53a6039e459055b0a1106c08cd8f682 /bindings/ruby
parent2e57ffb860f2ca986fcb60548e4907d6e8fa912a (diff)
ruby: improve general data get helper
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>
Diffstat (limited to 'bindings/ruby')
-rw-r--r--bindings/ruby/defs.h5
1 files 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) \