From c9a96e02f7cfb19ddc54387c28cc9a6c7318f0fc Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Wed, 25 Sep 2024 00:40:46 +0900 Subject: [PATCH] updated the same literal check in hcl_addliteraltocode() --- lib/xchg.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/xchg.c b/lib/xchg.c index 6acfff5..ce56d83 100644 --- a/lib/xchg.c +++ b/lib/xchg.c @@ -679,16 +679,13 @@ int hcl_addliteraltocode (hcl_t* hcl, hcl_code_t* code, hcl_oop_t obj, hcl_oow_t { tmp = ((hcl_oop_oop_t)code->lit.arr)->slot[i]; - if (tmp == obj) + if (tmp == obj || hcl_equalobjs(hcl, obj, tmp)) { - /* this removes redundancy of symbols, characters, and integers. */ - if (index) *index = i - lfbase; - return 0; - } - else if (HCL_IS_STRING(hcl, obj) && HCL_IS_STRING(hcl, tmp) && hcl_equalobjs(hcl, obj, tmp)) - { - /* a string object requires equality check. however, the string created to the literal frame - * must be made immutable. non-immutable string literals are source of various problems */ + /* this removes redundancy of symbols, characters, and integers. + * a string object requires equality check. however, + * the string created to the literal frame + * must be made immutable. non-immutable string literals are + * source of various problems */ if (index) *index = i - lfbase; return 0; }