Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:kjk/fofou
Browse files Browse the repository at this point in the history
  • Loading branch information
kjk committed Apr 14, 2017
2 parents bdf543d + e74b735 commit 16dd4e7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions store.go
Expand Up @@ -282,14 +282,15 @@ func (store *Store) readExistingData(fileDataPath string) error {
topicIDToTopic := make(map[int]*Topic)
for len(d) > 0 {
idx := bytes.IndexByte(d, '\n')
if -1 == idx {
// TODO: this could happen if the last record was only
// partially written. Should I just ignore it?
panic("idx shouldn't be -1")
var line []byte
if -1 != idx {
line = d[:idx]
d = d[idx+1:]
} else {
line = d
d = nil
}
line := d[:idx]
//fmt.Printf("%q len(topics)=%d\n", string(line), len(topics))
d = d[idx+1:]
c := line[0]
// T - topic
// P - post
Expand Down

0 comments on commit 16dd4e7

Please sign in to comment.