예제 #1
0
파일: db.go 프로젝트: Zirak/pacman-fs
func (db DB) GetPkgcache() []*Pkg {
	// This isn't pretty. get_pkgcache returns a pointer to a alpm_list.
	//we've defined that struct, but we need to convert that pointer to it.
	cache := (*PointerList)(unsafe.Pointer(C.alpm_db_get_pkgcache(db.ptr)))
	pkgs := []*Pkg{}

	cache.ForEach(func(pkgptr unsafe.Pointer) {
		pkg := pointerToPkg((*C.alpm_pkg_t)(pkgptr))
		pkgs = append(pkgs, pkg)
	})

	return pkgs
}
예제 #2
0
파일: db.go 프로젝트: Thibauth/go-alpm
// Returns the list of packages of the database
func (db Db) PkgCache() PackageList {
	pkgcache := (*list)(unsafe.Pointer(C.alpm_db_get_pkgcache(db.ptr)))
	return PackageList{pkgcache, db.handle}
}