diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-06-05 10:36:03 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-06-05 10:36:03 -0600 |
commit | fd100fd8425b82c09eba2e291d1dcbfcb1242774 (patch) | |
tree | 938e608438e512e939c505eaa6a86b0dc99c5d3d /pkg/btrfs/btrfsitem/item_uuid.go | |
parent | 30a2a24901e024dba8b40ca4102af9b4e64718c8 (diff) |
more, fixup array init
Diffstat (limited to 'pkg/btrfs/btrfsitem/item_uuid.go')
-rw-r--r-- | pkg/btrfs/btrfsitem/item_uuid.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/pkg/btrfs/btrfsitem/item_uuid.go b/pkg/btrfs/btrfsitem/item_uuid.go index 894ccff..d66e102 100644 --- a/pkg/btrfs/btrfsitem/item_uuid.go +++ b/pkg/btrfs/btrfsitem/item_uuid.go @@ -7,12 +7,10 @@ import ( // The Key for this item is a UUID, and the item is a list of // subvolume IDs (ObjectIDs) that that UUID maps to. -type UUIDMap struct { // UUID_SUBVOL=251 UUID_RECEIVED_SUBVOL=252 - SubvolIDs []internal.ObjID -} +type UUIDMap []internal.ObjID // UUID_SUBVOL=251 UUID_RECEIVED_SUBVOL=252 func (o *UUIDMap) UnmarshalBinary(dat []byte) (int, error) { - o.SubvolIDs = nil + *o = nil var n int for len(dat) > n { var subvolID internal.ObjID @@ -21,14 +19,14 @@ func (o *UUIDMap) UnmarshalBinary(dat []byte) (int, error) { if err != nil { return n, err } - o.SubvolIDs = append(o.SubvolIDs, subvolID) + *o = append(*o, subvolID) } return n, nil } func (o UUIDMap) MarshalBinary() ([]byte, error) { var ret []byte - for _, subvolID := range o.SubvolIDs { + for _, subvolID := range o { bs, err := binstruct.Marshal(subvolID) ret = append(ret, bs...) if err != nil { |