Ejemplo n.º 1
0
// OpenMemory creates an object from the given memory that can be scanned using ScanMapCb
func OpenMemory(start []byte) *Fmap {
	return (*Fmap)(C.cl_fmap_open_memory(unsafe.Pointer(&start[0]), C.size_t(len(start))))
}
Ejemplo n.º 2
0
/* FmapOpenMemory opens a map for scanning custom data, where the data is already in memory,
 * either in the form of a buffer, a memory mapped file, etc.
 * Note that the memory [start, start+len) must be the _entire_ file,
 * you can't give it parts of a file and expect detection to work.
 */
func FmapOpenMemory(buf []byte) *Fmap {
	if len(buf) == 0 {
		return nil
	}
	return (*Fmap)(C.cl_fmap_open_memory(unsafe.Pointer(&buf[0]), C.size_t(len(buf))))
}