diff options
Diffstat (limited to 'src/cmd/godoc/utils.go')
-rw-r--r-- | src/cmd/godoc/utils.go | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/src/cmd/godoc/utils.go b/src/cmd/godoc/utils.go index e2637ab3d..11e46aee5 100644 --- a/src/cmd/godoc/utils.go +++ b/src/cmd/godoc/utils.go @@ -18,7 +18,6 @@ import ( "utf8" ) - // An RWValue wraps a value and permits mutually exclusive // access to it and records the time the value was last set. // @@ -28,7 +27,6 @@ type RWValue struct { timestamp int64 // time of last set(), in seconds since epoch } - func (v *RWValue) set(value interface{}) { v.mutex.Lock() v.value = value @@ -36,14 +34,12 @@ func (v *RWValue) set(value interface{}) { v.mutex.Unlock() } - func (v *RWValue) get() (interface{}, int64) { v.mutex.RLock() defer v.mutex.RUnlock() return v.value, v.timestamp } - // TODO(gri) For now, using os.Getwd() is ok here since the functionality // based on this code is not invoked for the appengine version, // but this is fragile. Determine what the right thing to do is, @@ -94,7 +90,6 @@ func canonicalizePaths(list []string, filter func(path string) bool) []string { return list[0:i] } - // writeFileAtomically writes data to a temporary file and then // atomically renames that file to the file named by filename. // @@ -115,7 +110,6 @@ func writeFileAtomically(filename string, data []byte) os.Error { return os.Rename(f.Name(), filename) } - // isText returns true if a significant prefix of s looks like correct UTF-8; // that is, if it is likely that s is human-readable text. // @@ -129,7 +123,7 @@ func isText(s []byte) bool { // last char may be incomplete - ignore break } - if c == 0xFFFD || c < ' ' && c != '\n' && c != '\t' { + if c == 0xFFFD || c < ' ' && c != '\n' && c != '\t' && c != '\f' { // decoding error or control character - not a text file return false } @@ -137,7 +131,6 @@ func isText(s []byte) bool { return true } - // TODO(gri): Should have a mapping from extension to handler, eventually. // textExt[x] is true if the extension x indicates a text file, and false otherwise. @@ -146,7 +139,6 @@ var textExt = map[string]bool{ ".js": false, // must be served raw } - // isTextFile returns true if the file has a known extension indicating // a text file, or if a significant chunk of the specified file looks like // correct UTF-8; that is, if it is likely that the file contains human- |