summaryrefslogtreecommitdiffstats
path: root/struct.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-12-31 00:07:27 -0800
committerKaz Kylheku <kaz@kylheku.com>2017-12-31 00:07:27 -0800
commit900597a05d48be775bfb0e504e3179062806ff02 (patch)
tree416102dbbc8ad28703c977524ebd9a04ea01aa2d /struct.h
parent422eda12b8a931039a5bf613a8c260c3d6853403 (diff)
downloadtxr-900597a05d48be775bfb0e504e3179062806ff02.tar.gz
txr-900597a05d48be775bfb0e504e3179062806ff02.tar.bz2
txr-900597a05d48be775bfb0e504e3179062806ff02.zip
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.
Diffstat (limited to 'struct.h')
-rw-r--r--struct.h2
1 files changed, 2 insertions, 0 deletions
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);