updated the go wrapper code to save one memory allocation
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-02-24 22:53:34 +09:00
parent 6b279e1785
commit ba2e5d1ed6
2 changed files with 13 additions and 5 deletions

View File

@ -175,12 +175,12 @@ func (hcl *HCL) SetLogTarget(target string) {
var x C.int
var tgt *C.char
tgt = C.CString(target)
tgt = C.CString(target) // TODO: need error check?
defer C.free(unsafe.Pointer(tgt))
x = C.hcl_setoption(hcl.c, C.HCL_LOG_TARGET_BCSTR, unsafe.Pointer(tgt))
if x <= -1 {
// thist must not happen
// this must not happen
panic(fmt.Errorf("unable to set log target - %s", hcl.get_errmsg()))
}
}