()
| 63 | } |
| 64 | |
| 65 | func (d *defaultCommit) Notes() []Note { |
| 66 | count := d.FooterCount() |
| 67 | if count == 0 { |
| 68 | return nil |
| 69 | } |
| 70 | // Keep one backing slice for all notes instead of allocating each note. |
| 71 | values := make([]defaultNote, count) |
| 72 | notes := make([]Note, count) |
| 73 | for i := range values { |
| 74 | entry := d.FooterAt(i) |
| 75 | values[i] = defaultNote{ |
| 76 | token: entry.Token(), |
| 77 | value: entry.Value(), |
| 78 | } |
| 79 | notes[i] = &values[i] |
| 80 | } |
| 81 | return notes |
| 82 | } |
| 83 | |
| 84 | type defaultNote struct { |
| 85 | token string |