vendor: Mega update all dependencies

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4080
This commit is contained in:
Jakob Borg
2017-04-05 14:34:41 +00:00
parent 49c1527724
commit a1bcc15458
1354 changed files with 55066 additions and 797850 deletions

View File

@@ -2,7 +2,10 @@
package maxminddb
import "os"
import (
"os"
"runtime"
)
// Open takes a string path to a MaxMind DB file and returns a Reader
// structure or an error. The database file is opened using a memory map,
@@ -41,16 +44,18 @@ func Open(file string) (*Reader, error) {
}
reader.hasMappedFile = true
runtime.SetFinalizer(reader, (*Reader).Close)
return reader, err
}
// Close unmaps the database file from virtual memory and returns the
// resources to the system. If called on a Reader opened using FromBytes
// or Open on Google App Engine, this method does nothing.
func (r *Reader) Close() (err error) {
if r.hasMappedFile {
err = munmap(r.buffer)
r.hasMappedFile = false
func (r *Reader) Close() error {
if !r.hasMappedFile {
return nil
}
return err
runtime.SetFinalizer(r, nil)
r.hasMappedFile = false
return munmap(r.buffer)
}