提交 9a335cee 作者: Steven Allen

fewer allocations on unpin

License: MIT
Signed-off-by: 's avatarSteven Allen <steven@stebalien.com>
上级 498ee0dc
......@@ -58,14 +58,14 @@ func Pin(n *core.IpfsNode, ctx context.Context, paths []string, recursive bool)
}
func Unpin(n *core.IpfsNode, ctx context.Context, paths []string, recursive bool) ([]*cid.Cid, error) {
var unpinned []*cid.Cid
unpinned := make([]*cid.Cid, len(paths))
r := &path.Resolver{
DAG: n.DAG,
ResolveOnce: uio.ResolveUnixfsOnce,
}
for _, p := range paths {
for i, p := range paths {
p, err := path.ParsePath(p)
if err != nil {
return nil, err
......@@ -80,7 +80,7 @@ func Unpin(n *core.IpfsNode, ctx context.Context, paths []string, recursive bool
if err != nil {
return nil, err
}
unpinned = append(unpinned, k)
unpinned[i] = k
}
err := n.Pinning.Flush()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论