mirror of
https://github.com/containers/podman.git
synced 2025-09-19 23:03:16 +08:00
Better emptiness test for custom JSON serializer
Signed-off-by: Matej Vasek <mvasek@redhat.com>
This commit is contained in:
@ -145,12 +145,12 @@ func MarshalErrorSliceJSON(ptr unsafe.Pointer, stream *jsoniter.Stream) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func MarshalErrorJSONIsEmpty(_ unsafe.Pointer) bool {
|
func MarshalErrorJSONIsEmpty(ptr unsafe.Pointer) bool {
|
||||||
return false
|
return *((*error)(ptr)) == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func MarshalErrorSliceJSONIsEmpty(_ unsafe.Pointer) bool {
|
func MarshalErrorSliceJSONIsEmpty(ptr unsafe.Pointer) bool {
|
||||||
return false
|
return len(*((*[]error)(ptr))) <= 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteJSON writes an interface value encoded as JSON to w
|
// WriteJSON writes an interface value encoded as JSON to w
|
||||||
|
Reference in New Issue
Block a user