From a98f592b85ae9ba76477285e8b83e50d3fa2d4b8 Mon Sep 17 00:00:00 2001 From: simon987 Date: Sat, 28 Dec 2019 21:04:35 -0500 Subject: [PATCH] Remove debug code --- fastimagehash.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/fastimagehash.go b/fastimagehash.go index 34aa23d..e2b5834 100644 --- a/fastimagehash.go +++ b/fastimagehash.go @@ -185,13 +185,7 @@ func PHashFile(filepath string, hashSize, highFreqFactor int) (*Hash, Code) { func PHashMem(buf []byte, hashSize, highFreqFactor int) (*Hash, Code) { var ret C.int - - p := C.malloc(C.size_t(len(buf))) - cBuf := (*[1 << 30]byte)(p) - copy(cBuf[:], buf) - - hash := C.phash_mem_wr(p, C.size_t(len(buf)), C.int(hashSize), C.int(highFreqFactor), &ret) - C.free(p) + hash := C.phash_mem_wr(unsafe.Pointer(&buf[0]), C.size_t(len(buf)), C.int(hashSize), C.int(highFreqFactor), &ret) return retHash(hash, hashSize, ret) }