summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Valentine-House <matt@eightbitraptor.com>2026-01-26 12:46:00 +0000
committerMatt Valentine-House <matt@eightbitraptor.com>2026-01-26 18:01:09 +0000
commit3c634893e245c578181e8337b4025d1f673d77e8 (patch)
tree490bf631e129d194f310032beb3932851ed1e6d8
parentd15117e2937b78b0868e0f41336f6350bbf1a1c4 (diff)
Remove the unnecesary integer comparison
Most compilers will optimise this anyway
-rw-r--r--gc.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/gc.c b/gc.c
index d1b504ed00..f1c7f834d0 100644
--- a/gc.c
+++ b/gc.c
@@ -1282,9 +1282,7 @@ rb_gc_obj_needs_cleanup_p(VALUE obj)
uintptr_t type = (uintptr_t)RTYPEDDATA(obj)->type;
if (type & TYPED_DATA_EMBEDDED) {
RUBY_DATA_FUNC dfree = ((const rb_data_type_t *)(type & TYPED_DATA_PTR_MASK))->function.dfree;
- // Fast path for embedded T_DATA with no custom free function.
- // True when dfree is NULL (RUBY_NEVER_FREE) or -1 (RUBY_TYPED_DEFAULT_FREE).
- if ((uintptr_t)dfree + 1 <= 1) return false;
+ return (dfree == RUBY_NEVER_FREE || dfree == RUBY_TYPED_DEFAULT_FREE);
}
}
return true;