diff options
author | Josh Bleecher Snyder <josharian@gmail.com> | 2016-12-22 17:05:52 -0800 |
---|---|---|
committer | Josh Bleecher Snyder <josharian@gmail.com> | 2016-12-23 08:56:04 -0800 |
commit | 1858583b3b0b9db3794a35fa9689c8c351363dbf (patch) | |
tree | 0f88c13603617db27ffd9dedb399dd05bec38ee4 /freelist.go | |
parent | Merge pull request #636 from josharian/perf (diff) | |
download | dedo-1858583b3b0b9db3794a35fa9689c8c351363dbf.tar.gz dedo-1858583b3b0b9db3794a35fa9689c8c351363dbf.tar.xz |
Clean up after #636
freelist.lenall duplicated freelist.count.
freelist.copyall and mergepgids docs had typos.
Diffstat (limited to 'freelist.go')
-rw-r--r-- | freelist.go | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/freelist.go b/freelist.go index 53efa8f..e07bf0a 100644 --- a/freelist.go +++ b/freelist.go @@ -46,17 +46,8 @@ func (f *freelist) pending_count() int { return count } -// lenall returns the combined number of all free ids and all pending ids. -func (f *freelist) lenall() int { - n := len(f.ids) - for _, list := range f.pending { - n += len(list) - } - return n -} - -// all copies into dst a list of all free ids and all pending ids in one sorted list. -// f.lenall returns the minimum length required for dst. +// copyall copies into dst a list of all free ids and all pending ids in one sorted list. +// f.count returns the minimum length required for dst. func (f *freelist) copyall(dst []pgid) { m := make(pgids, 0, len(f.pending)) // len(f.pending) undercounts, but it is a start for _, list := range f.pending { @@ -200,7 +191,7 @@ func (f *freelist) write(p *page) error { // The page.count can only hold up to 64k elements so if we overflow that // number then we handle it by putting the size in the first element. - lenids := f.lenall() + lenids := f.count() if lenids == 0 { p.count = uint16(lenids) } else if lenids < 0xFFFF { |