Example #1
0
func (cfg *Config) GetInt32(name string) (int32, error) {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	var cval C.int32_t
	ecode := C.git_config_get_int32(&cval, cfg.git_config, cname)
	if ecode != git_SUCCESS {
		return 0, gitError()
	}
	return int32(cval), nil
}
Example #2
0
func (c *Config) LookupInt32(name string) (v int32, err error) {
	var out C.int32_t
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))

	ret := C.git_config_get_int32(&out, c.ptr, cname)
	if ret < 0 {
		return 0, LastError()
	}

	return int32(out), nil
}
Example #3
0
File: config.go Project: wid/git2go
func (c *Config) LookupInt32(name string) (int32, error) {
	var out C.int32_t
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ret := C.git_config_get_int32(&out, c.ptr, cname)
	if ret < 0 {
		return 0, MakeGitError(ret)
	}

	return int32(out), nil
}