ruby: add unlikely hint

The error path is very unlikely.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
This commit is contained in:
Felipe Contreras 2021-05-15 16:20:59 -05:00 committed by David Bremner
parent 79bb82c217
commit 682479592b

View file

@ -58,7 +58,7 @@ extern ID ID_db_mode;
#define Data_Get_Notmuch_Object(obj, ptr) \ #define Data_Get_Notmuch_Object(obj, ptr) \
do { \ do { \
(ptr) = rb_data_object_get ((obj)); \ (ptr) = rb_data_object_get ((obj)); \
if (!(ptr)) { \ if (RB_UNLIKELY (!(ptr))) { \
VALUE cname = rb_class_name (CLASS_OF ((obj))); \ VALUE cname = rb_class_name (CLASS_OF ((obj))); \
rb_raise (rb_eRuntimeError, "%"PRIsVALUE" object destroyed", cname); \ rb_raise (rb_eRuntimeError, "%"PRIsVALUE" object destroyed", cname); \
} \ } \