[#64] object: Allow to reset marshal data
All checks were successful
DCO action / DCO (pull_request) Successful in 58s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m24s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m32s
Tests and linters / Lint (pull_request) Successful in 1m43s
Tests and linters / Tests with -race (pull_request) Successful in 2m5s
All checks were successful
DCO action / DCO (pull_request) Successful in 58s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m24s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m32s
Tests and linters / Lint (pull_request) Successful in 1m43s
Tests and linters / Tests with -race (pull_request) Successful in 2m5s
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
d60ce83e42
commit
2a124b95bc
1 changed files with 2 additions and 6 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue