[PATCH v3 3/7] ruby: add unlikely hint

Subject: [PATCH v3 3/7] ruby: add unlikely hint

Date: Sat, 15 May 2021 16:20:59 -0500

To: notmuch@notmuchmail.org

Cc: Ali Polatel, Austin Clements, Tomi Ollila, Ludovic LANGE, Daniel Kahn Gillmor

From: Felipe Contreras


The error path is very unlikely.

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

diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h
index ae3ea101..12538a3a 100644
--- a/bindings/ruby/defs.h
+++ b/bindings/ruby/defs.h
@@ -58,7 +58,7 @@ extern ID ID_db_mode;
 #define Data_Get_Notmuch_Object(obj, ptr)					    \
     do {									    \
 	(ptr) = rb_data_object_get ((obj));					    \
-	if (!(ptr)) {								    \
+	if (RB_UNLIKELY (!(ptr))) {						    \
 	    VALUE cname = rb_class_name (CLASS_OF ((obj)));			    \
 	    rb_raise (rb_eRuntimeError, "%"PRIsVALUE" object destroyed", cname);    \
 	}									    \
-- 
2.31.1
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: