Skip to content

Commit

Permalink
all tests passing now
Browse files Browse the repository at this point in the history
  • Loading branch information
Ameer Ayoub committed Jun 6, 2015
1 parent 96c90fd commit 4207dd4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
12 changes: 4 additions & 8 deletions codesearch/index/mmap_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,15 @@ func mmapFile(f *os.File) mmapData {
}

func unmmapFile(m *mmapData) error {
err := syscall.UnmapViewOfFile(uintptr(unsafe.Pointer(&m.d)))
err := syscall.UnmapViewOfFile(uintptr(unsafe.Pointer(&m.d[0])))
if err != nil {
log.Fatalf("UnmapViewOfFile %s: %v", m.f.Name(), err)
return err
}
err = syscall.CloseHandle(syscall.Handle(m.f.Fd()))
if err != nil {
log.Fatalf("CloseHandle %s: %v", m.f.Name(), err)
log.Fatalf(err)
return err
}

err = m.f.Close()
if err != nil {
log.Fatalf("Close %s: %v", m.f.Name(), err)
log.Fatal(err)
return err
}

Expand Down
4 changes: 4 additions & 0 deletions codesearch/index/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@ func (ix *IndexWriter) Flush() {
ix.main.flush()
}

func (ix *IndexWriter) Close() {
ix.main.file.Close()
}

func copyFile(dst, src *bufWriter) {
dst.flush()
_, err := io.Copy(dst.file, src.finish())
Expand Down
1 change: 1 addition & 0 deletions index/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ func containsString(haystack []string, needle string) bool {

func indexAllFiles(opt *IndexOptions, dst, src string) error {
ix := index.Create(filepath.Join(dst, "tri"))
defer ix.Close()

excluded := []*ExcludedFile{}

Expand Down

0 comments on commit 4207dd4

Please sign in to comment.