mirror of https://github.com/ceph/go-ceph
rados: convert ListPools to use cutil.SplitSparseBuffer
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
parent
bfe4adfd2d
commit
08bb0096c4
|
@ -6,9 +6,9 @@ package rados
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
"github.com/ceph/go-ceph/internal/cutil"
|
||||||
"github.com/ceph/go-ceph/internal/retry"
|
"github.com/ceph/go-ceph/internal/retry"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -117,14 +117,7 @@ func (c *Conn) ListPools() (names []string, err error) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp := bytes.SplitAfter(buf[:ret-1], []byte{0})
|
names = cutil.SplitSparseBuffer(buf[:ret])
|
||||||
for _, s := range tmp {
|
|
||||||
if len(s) > 0 {
|
|
||||||
name := C.GoString((*C.char)(unsafe.Pointer(&s[0])))
|
|
||||||
names = append(names, name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return names, nil
|
return names, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue