Commit d4933eb8 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Minimize number of bytes/string conversions in request.{filename,filenames}.

parent 05abe73d
......@@ -4,11 +4,11 @@
package fuse
import (
"bytes"
"fmt"
"log"
"os"
"reflect"
"strings"
"syscall"
"time"
"unsafe"
......@@ -45,14 +45,18 @@ type request struct {
}
func (me *request) filename() string {
return strings.TrimRight(string(me.arg), "\x00")
return string(me.arg[:len(me.arg)-1])
}
func (me *request) filenames(count int) []string {
return strings.Split(string(me.arg), "\x00", count)
names := bytes.Split(me.arg[:len(me.arg)-1], []byte{0}, count)
nameStrings := make([]string, len(names))
for i, n := range names {
nameStrings[i] = string(n)
}
return nameStrings
}
////////////////////////////////////////////////////////////////
// State related to this mount point.
type MountState struct {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment