From 900597a05d48be775bfb0e504e3179062806ff02 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 31 Dec 2017 00:07:27 -0800 Subject: New inlined test for struct object. * lib.c (seq_info, car, cdr, make_like, nullify, generic_funcall, copy, length, empty, ref, refset, dwim_set, dwim_del, populate_obj_hash): Use new obj_struct_p test when we know that the object is a COBJ. * struct.c (struct_inst_ops): Change from static to extern. * struct.h (ob_struct_p): New inline function. --- struct.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'struct.h') diff --git a/struct.h b/struct.h index cab0799d..6fdcff9a 100644 --- a/struct.h +++ b/struct.h @@ -28,6 +28,7 @@ extern val struct_type_s, meth_s, print_s, make_struct_lit_s; extern val init_k, postinit_k; extern val slot_s, static_slot_s; +extern struct cobj_ops struct_inst_ops; val make_struct_type(val name, val super, val static_slots, val slots, val static_initfun, val initfun, val boactor, @@ -74,4 +75,5 @@ val slot_types(val slot); val static_slot_types(val slot); val slot_type_reg(val slot, val strct); val static_slot_type_reg(val slot, val strct); +INLINE int obj_struct_p(val obj) { return obj->co.ops == &struct_inst_ops; } void struct_init(void); -- cgit v1.2.3