mirror of
https://github.com/logos-messaging/go-multiaddr.git
synced 2026-01-02 04:53:07 +00:00
remove unused bytesSplit function
This commit is contained in:
parent
d7d65e5590
commit
e2f4e4e83c
26
codec.go
26
codec.go
@ -176,29 +176,3 @@ func sizeForAddr(p Protocol, b []byte) (skip, size int, err error) {
|
||||
return n, size, nil
|
||||
}
|
||||
}
|
||||
|
||||
func bytesSplit(b []byte) ([][]byte, error) {
|
||||
var ret [][]byte
|
||||
for len(b) > 0 {
|
||||
code, n, err := ReadVarintCode(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
p := ProtocolWithCode(code)
|
||||
if p.Code == 0 {
|
||||
return nil, fmt.Errorf("no protocol with code %d", b[0])
|
||||
}
|
||||
|
||||
n2, size, err := sizeForAddr(p, b[n:])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
length := n + n2 + size
|
||||
ret = append(ret, b[:length])
|
||||
b = b[length:]
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user