From 33db65a8b96ee15b89cca34728140549aaaec13b Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Thu, 11 Feb 2021 14:14:49 +0000 Subject: [PATCH] set the defailt logging mask to 0. fixed wrong format specifiers in std.c --- lib/hcl.c | 3 ++- lib/std.c | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/hcl.c b/lib/hcl.c index 9d5c795..22142a9 100644 --- a/lib/hcl.c +++ b/lib/hcl.c @@ -120,7 +120,8 @@ int hcl_init (hcl_t* hcl, hcl_mmgr_t* mmgr, const hcl_vmprim_t* vmprim) if (!hcl->vmprim.alloc_heap) hcl->vmprim.alloc_heap = alloc_heap; if (!hcl->vmprim.free_heap) hcl->vmprim.free_heap = free_heap; - hcl->option.log_mask = ~(hcl_bitmask_t)0; + /*hcl->option.log_mask = HCL_LOG_ALL_LEVELS | HCL_LOG_ALL_TYPES;*/ + hcl->option.log_mask = (hcl_bitmask_t)0; /* log nothing by default */ hcl->option.log_maxcapa = HCL_DFL_LOG_MAXCAPA; hcl->option.dfl_symtab_size = HCL_DFL_SYMTAB_SIZE; hcl->option.dfl_sysdic_size = HCL_DFL_SYSDIC_SIZE; diff --git a/lib/std.c b/lib/std.c index b8b0849..3d15e45 100644 --- a/lib/std.c +++ b/lib/std.c @@ -904,7 +904,7 @@ static void backtrace_stack_frames (hcl_t* hcl) } hcl_logbfmt (hcl, HCL_LOG_UNTYPED | HCL_LOG_DEBUG, - "#%02d ip=0x%*p sp=0x%*p %s+0x%zu\n", + "#%02d ip=0x%*p sp=0x%*p %hs+0x%zu\n", n, HCL_SIZEOF(void*) * 2, (void*)ip, HCL_SIZEOF(void*) * 2, (void*)sp, symbol, (hcl_oow_t)off); } } @@ -925,7 +925,7 @@ static void backtrace_stack_frames (hcl_t* hcl) for (i = 0; i < btsize; i++) { - hcl_logbfmt(hcl, HCL_LOG_UNTYPED | HCL_LOG_DEBUG, " %s\n", btsyms[i]); + hcl_logbfmt (hcl, HCL_LOG_UNTYPED | HCL_LOG_DEBUG, " %hs\n", btsyms[i]); } free (btsyms); } @@ -939,7 +939,7 @@ static void backtrace_stack_frames (hcl_t* hcl) static void _assertfail (hcl_t* hcl, const hcl_bch_t* expr, const hcl_bch_t* file, hcl_oow_t line) { - hcl_logbfmt (hcl, HCL_LOG_UNTYPED | HCL_LOG_FATAL, "ASSERTION FAILURE: %s at %s:%zu\n", expr, file, line); + hcl_logbfmt (hcl, HCL_LOG_UNTYPED | HCL_LOG_FATAL, "ASSERTION FAILURE: %hs at %hs:%zu\n", expr, file, line); backtrace_stack_frames (hcl); #if defined(_WIN32) @@ -2099,7 +2099,7 @@ static void vm_muxwait (hcl_t* hcl, const hcl_ntime_t* dur, hcl_vmprim_muxwait_c if (n <= -1) { hcl_seterrwithsyserr (hcl, 0, errno); - HCL_DEBUG2 (hcl, "Warning: multiplexer wait failure - %d, %s\n", errno, hcl_geterrmsg(hcl)); + HCL_DEBUG2 (hcl, "Warning: multiplexer wait failure - %d, %js\n", errno, hcl_geterrmsg(hcl)); } else { @@ -2502,7 +2502,7 @@ static void* dl_open (hcl_t* hcl, const hcl_ooch_t* name, int flags) { const hcl_bch_t* dl_errstr; dl_errstr = sys_dl_error(); - HCL_DEBUG2 (hcl, "Unable to open(ext) DL %hs - %s\n", bufptr, dl_errstr); + HCL_DEBUG2 (hcl, "Unable to open(ext) DL %hs - %hs\n", bufptr, dl_errstr); hcl_seterrbfmt (hcl, HCL_ESYSERR, "unable to open(ext) DL %js - %hs", name, dl_errstr); } else HCL_DEBUG2 (hcl, "Opened(ext) DL %hs handle %p\n", bufptr, handle);