diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-07-12 05:53:49 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-07-12 06:03:04 +0300 |
commit | 0708b9aba8f7da87c4cf97b96c0bc9229fa9689c (patch) | |
tree | 63588657c286dfeb0d0ce99b64c16dbfbbd93213 /source/blender/blenloader/intern/writefile.c | |
parent | 4db1db327a0613abee950ffe12b013afdec2c111 (diff) |
writefile: reuse SDNA between writes
Avoids decoding the SDNA string every undo step.
Diffstat (limited to 'source/blender/blenloader/intern/writefile.c')
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index f898eea566d..88f1c4d5e4a 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -303,7 +303,7 @@ static void ww_handle_init(eWriteWrapType ww_type, WriteWrap *r_ww) typedef struct { - struct SDNA *sdna; + const struct SDNA *sdna; unsigned char *buf; MemFile *compare, *current; @@ -325,7 +325,7 @@ static WriteData *writedata_new(WriteWrap *ww) { WriteData *wd = MEM_callocN(sizeof(*wd), "writedata"); - wd->sdna = DNA_sdna_from_data(DNAstr, DNAlen, false, false, NULL); + wd->sdna = DNA_sdna_current_get(); wd->ww = ww; @@ -357,8 +357,6 @@ static void writedata_do_write(WriteData *wd, const void *mem, int memlen) static void writedata_free(WriteData *wd) { - DNA_sdna_free(wd->sdna); - MEM_freeN(wd->buf); MEM_freeN(wd); } |