variable.c (iv_size): refactor the function
authorYukihiro "Matz" Matsumoto <[email protected]>
Tue, 27 May 2025 01:16:12 +0000 (27 10:16 +0900)
committerYukihiro "Matz" Matsumoto <[email protected]>
Tue, 27 May 2025 01:16:12 +0000 (27 10:16 +0900)
Along with removing an obsolete comment line.

src/variable.c

index 1208304..e7c53d3 100644 (file)
@@ -192,12 +192,10 @@ iv_foreach(mrb_state *mrb, iv_tbl *t, mrb_iv_foreach_func *func, void *p)
 }
 
 /* Get the size of the instance variable table. */
-/* Size is approximated by the allocated table size. */
 static size_t
 iv_size(mrb_state *mrb, iv_tbl *t)
 {
-  if (t == NULL) return 0;
-  return (size_t)t->size;
+  return t ? t->size : 0;
 }
 
 /* Copy the instance variable table. */