rados: add a function for use as a finalizer for any opStep
This utility function avoids having to have a custom finalizer for every
op step. It calls the free() function to release any allocated C memory
the step may have.
@@ -112,6 +112,12 @@ func (o *operation) update(kind opKind, ret C.int) error {
}
}
+func opStepFinalizer(s opStep) {
+ if s != nil {
+ s.free()
+ }
+}
+
// withoutUpdate can be embedded in a struct to help indicate
// the type implements the opStep interface but has a no-op
// update function.
