[#64] object: Allow to reset marshal data

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2024-02-15 14:41:33 +03:00 committed by Evgenii Stratonikov
parent a666f9c0a3
commit e4ac613c8e

View file

@ -346,16 +346,12 @@ func (o *Object) StableMarshal(buf []byte) []byte {
// SetMarshalData sets marshal data to reduce memory allocations.
//
// It is unsafe to modify object data after setting marshal data.
// It is unsafe to modify/copy object data after setting marshal data.
func (o *Object) SetMarshalData(data []byte) {
if o == nil {
return
}
if data == nil {
o.marshalData = o.StableMarshal(nil)
} else {
o.marshalData = data
}
o.marshalData = data
}
func (o *Object) StableSize() (size int) {