From 07e7785241f81e3dff184827f094b462b42c708a Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Sun, 21 Feb 2016 05:39:15 +0900 Subject: [PATCH] insert assertion to pic_foo_ptr --- extlib/benz/include/picrin/private/object.h | 28 ++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/extlib/benz/include/picrin/private/object.h b/extlib/benz/include/picrin/private/object.h index b3cc4b4a..6f50bdfb 100644 --- a/extlib/benz/include/picrin/private/object.h +++ b/extlib/benz/include/picrin/private/object.h @@ -140,20 +140,20 @@ struct pic_checkpoint { struct pic_object *pic_obj_ptr(pic_value); -#define pic_id_ptr(pic, o) ((pic_id *)pic_obj_ptr(o)) -#define pic_sym_ptr(pic, o) ((pic_sym *)pic_obj_ptr(o)) -#define pic_str_ptr(pic, o) ((struct pic_string *)pic_obj_ptr(o)) -#define pic_blob_ptr(pic, o) ((struct pic_blob *)pic_obj_ptr(o)) -#define pic_pair_ptr(pic, o) ((struct pic_pair *)pic_obj_ptr(o)) -#define pic_vec_ptr(pic, o) ((struct pic_vector *)pic_obj_ptr(o)) -#define pic_dict_ptr(pic, o) ((struct pic_dict *)pic_obj_ptr(o)) -#define pic_weak_ptr(pic, o) ((struct pic_weak *)pic_obj_ptr(o)) -#define pic_data_ptr(pic, o) ((struct pic_data *)pic_obj_ptr(o)) -#define pic_proc_ptr(pic, o) ((struct pic_proc *)pic_obj_ptr(o)) -#define pic_env_ptr(pic, o) ((struct pic_env *)pic_obj_ptr(o)) -#define pic_port_ptr(pic, o) ((struct pic_port *)pic_obj_ptr(o)) -#define pic_error_ptr(pic, o) ((struct pic_error *)pic_obj_ptr(o)) -#define pic_rec_ptr(pic, o) ((struct pic_record *)pic_obj_ptr(o)) +#define pic_id_ptr(pic, o) (assert(pic_id_p(pic, o)), (pic_id *)pic_obj_ptr(o)) +#define pic_sym_ptr(pic, o) (assert(pic_sym_p(pic, o)), (pic_sym *)pic_obj_ptr(o)) +#define pic_str_ptr(pic, o) (assert(pic_str_p(pic, o)), (struct pic_string *)pic_obj_ptr(o)) +#define pic_blob_ptr(pic, o) (assert(pic_blob_p(pic, o)), (struct pic_blob *)pic_obj_ptr(o)) +#define pic_pair_ptr(pic, o) (assert(pic_pair_p(pic, o)), (struct pic_pair *)pic_obj_ptr(o)) +#define pic_vec_ptr(pic, o) (assert(pic_vec_p(pic, o)), (struct pic_vector *)pic_obj_ptr(o)) +#define pic_dict_ptr(pic, o) (assert(pic_dict_p(pic, o)), (struct pic_dict *)pic_obj_ptr(o)) +#define pic_weak_ptr(pic, o) (assert(pic_weak_p(pic, o)), (struct pic_weak *)pic_obj_ptr(o)) +#define pic_data_ptr(pic, o) (assert(pic_data_p(pic, o, NULL)), (struct pic_data *)pic_obj_ptr(o)) +#define pic_proc_ptr(pic, o) (assert(pic_proc_p(pic, o)), (struct pic_proc *)pic_obj_ptr(o)) +#define pic_env_ptr(pic, o) (assert(pic_env_p(pic, o)), (struct pic_env *)pic_obj_ptr(o)) +#define pic_port_ptr(pic, o) (assert(pic_port_p(pic, o)), (struct pic_port *)pic_obj_ptr(o)) +#define pic_error_ptr(pic, o) (assert(pic_error_p(pic, o)), (struct pic_error *)pic_obj_ptr(o)) +#define pic_rec_ptr(pic, o) (assert(pic_rec_p(pic, o)), (struct pic_record *)pic_obj_ptr(o)) #define pic_obj_p(pic,v) (pic_type(pic,v) > PIC_IVAL_END) #define pic_env_p(pic, v) (pic_type(pic, v) == PIC_TYPE_ENV)