some optimizations
This commit is contained in:
parent
f0a9462041
commit
87d53b5018
|
|
@ -152,7 +152,7 @@ func (e *Editor) PutSegment(seg *Segment) (int, int, error) {
|
||||||
found = true
|
found = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if found == false {
|
if !found {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -259,7 +259,7 @@ func (e *Editor) PutFile(src string) (int, int, error) {
|
||||||
|
|
||||||
func (e *Editor) Save() error {
|
func (e *Editor) Save() error {
|
||||||
// check the to-save flag
|
// check the to-save flag
|
||||||
if e.toSave == false {
|
if !e.toSave {
|
||||||
return fmt.Errorf("nothing changed")
|
return fmt.Errorf("nothing changed")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ func TestIterateSegments(t *testing.T) {
|
||||||
t.Fatalf("failed to open tests file: %s", err)
|
t.Fatalf("failed to open tests file: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = IterateSegments(handle, func(l string) {
|
_ = IterateSegments(handle, func(l string) {
|
||||||
// fmt.Printf("load segment: `%s`\n", l)
|
// fmt.Printf("load segment: `%s`\n", l)
|
||||||
}, func(seg *Segment) error {
|
}, func(seg *Segment) error {
|
||||||
fmt.Printf("get segment: `%s`\n", seg)
|
fmt.Printf("get segment: `%s`\n", seg)
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ type Version struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *Version) String() string {
|
func (v *Version) String() string {
|
||||||
return fmt.Sprintf("{Id:%d, Name:%d, Bytes:%d, IndexSize: %d}", v.Id, v.Name, v.Bytes, v.SegmentIndexSize)
|
return fmt.Sprintf("{Id:%d, Name:%s, Bytes:%d, IndexSize: %d}", v.Id, v.Name, v.Bytes, v.SegmentIndexSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue