From a61f6f5f474831d1698b62ea59150a1b06f51b79 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 31 Dec 2021 08:39:12 +0000 Subject: [PATCH] fixed the missing prototype defintion of hcl_instantiate() --- lib/hcl-prv.h | 7 +++++++ lib/obj.c | 30 +++++++++++++++--------------- lib/prim.c | 1 - 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/lib/hcl-prv.h b/lib/hcl-prv.h index 131a3c3..d6f6f56 100644 --- a/lib/hcl-prv.h +++ b/lib/hcl-prv.h @@ -1061,6 +1061,13 @@ hcl_oop_t hcl_allocwordobj ( hcl_oow_t len ); +hcl_oop_t hcl_instantiate ( + hcl_t* hcl, + hcl_oop_class_t _class, + const void* vptr, + hcl_oow_t vlen +); + /* ========================================================================= */ /* sym.c */ /* ========================================================================= */ diff --git a/lib/obj.c b/lib/obj.c index d53fed1..3bf0d92 100644 --- a/lib/obj.c +++ b/lib/obj.c @@ -380,7 +380,7 @@ static HCL_INLINE int decode_spec (hcl_t* hcl, hcl_oop_class_t _class, hcl_obj_t return 0; } -hcl_oop_t hcl_instantiate (hcl_t*hcl, hcl_oop_class_t _class, const void* vptr, hcl_oow_t vlen) +hcl_oop_t hcl_instantiate (hcl_t* hcl, hcl_oop_class_t _class, const void* vptr, hcl_oow_t vlen) { hcl_oop_t oop; hcl_obj_type_t type; @@ -402,22 +402,22 @@ hcl_oop_t hcl_instantiate (hcl_t*hcl, hcl_oop_class_t _class, const void* vptr, if (HCL_LIKELY(oop)) { #if 0 - /* initialize named instance variables with default values */ - if (_class->initv[0] != hcl->_nil) - { - hcl_oow_t i = HCL_OBJ_GET_SIZE(_class->initv[0]); + /* initialize named instance variables with default values */ + if (_class->initv[0] != hcl->_nil) + { + hcl_oow_t i = HCL_OBJ_GET_SIZE(_class->initv[0]); - /* [NOTE] i don't deep-copy initial values. - * if you change the contents of compound values like arrays, - * it affects subsequent instantiation of the class. - * it's important that the compiler should mark compound initial - * values read-only. */ - while (i > 0) - { - --i; - HCL_OBJ_SET_OOP_VAL (oop, i, HCL_OBJ_GET_OOP_VAL(_class->initv[0], i)); - } + /* [NOTE] i don't deep-copy initial values. + * if you change the contents of compound values like arrays, + * it affects subsequent instantiation of the class. + * it's important that the compiler should mark compound initial + * values read-only. */ + while (i > 0) + { + --i; + HCL_OBJ_SET_OOP_VAL (oop, i, HCL_OBJ_GET_OOP_VAL(_class->initv[0], i)); } + } #endif } HCL_ASSERT (hcl, vptr == HCL_NULL); diff --git a/lib/prim.c b/lib/prim.c index d01425c..2d1d193 100644 --- a/lib/prim.c +++ b/lib/prim.c @@ -881,7 +881,6 @@ static hcl_pfrc_t pf_object_new (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs) obj = hcl_instantiate(hcl, class_, HCL_NULL, 0); if (HCL_UNLIKELY(!obj)) return HCL_PF_FAILURE; - HCL_STACK_SETRET (hcl, nargs, obj); return HCL_PF_SUCCESS; }