diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2022-03-02 18:03:01 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2022-03-02 18:03:01 +0300 |
commit | a41c2a513761e8884e92526b069ff6eed8168676 (patch) | |
tree | e624093127815a09d2807dccddaabea35510e154 /source/blender/blenloader/intern/readfile.c | |
parent | a23b4429915ca8597510b57353c4df331487c620 (diff) | |
parent | c23ec04b4e30f300a670f1cb1dc882e0608d09ad (diff) |
Merge branch 'master' into temp-image-buffer-rasterizertemp-image-buffer-rasterizer
Diffstat (limited to 'source/blender/blenloader/intern/readfile.c')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 84625fea6fc..9539436cf69 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -320,15 +320,22 @@ static void oldnewmap_increase_size(OldNewMap *onm) /* Public OldNewMap API */ -static OldNewMap *oldnewmap_new(void) +static void oldnewmap_init_data(OldNewMap *onm, const int capacity_exp) { - OldNewMap *onm = MEM_callocN(sizeof(*onm), "OldNewMap"); + memset(onm, 0x0, sizeof(*onm)); - onm->capacity_exp = DEFAULT_SIZE_EXP; + onm->capacity_exp = capacity_exp; onm->entries = MEM_malloc_arrayN( ENTRIES_CAPACITY(onm), sizeof(*onm->entries), "OldNewMap.entries"); onm->map = MEM_malloc_arrayN(MAP_CAPACITY(onm), sizeof(*onm->map), "OldNewMap.map"); oldnewmap_clear_map(onm); +} + +static OldNewMap *oldnewmap_new(void) +{ + OldNewMap *onm = MEM_mallocN(sizeof(*onm), "OldNewMap"); + + oldnewmap_init_data(onm, DEFAULT_SIZE_EXP); return onm; } @@ -395,9 +402,10 @@ static void oldnewmap_clear(OldNewMap *onm) } } - onm->capacity_exp = DEFAULT_SIZE_EXP; - oldnewmap_clear_map(onm); - onm->nentries = 0; + MEM_freeN(onm->entries); + MEM_freeN(onm->map); + + oldnewmap_init_data(onm, DEFAULT_SIZE_EXP); } static void oldnewmap_free(OldNewMap *onm) @@ -2913,7 +2921,7 @@ static const char *dataname(short id_code) return "Data from MA"; case ID_TE: return "Data from TE"; - case ID_CU: + case ID_CU_LEGACY: return "Data from CU"; case ID_GR: return "Data from GR"; |