Ejemplo n.º 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
}
Ejemplo n.º 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
}
Ejemplo n.º 3
0
Archivo: config.go Proyecto: 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
}