Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/blenloader/intern/readblenentry.c
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/blenloader/intern/readblenentry.c')
-rw-r--r--source/blender/blenloader/intern/readblenentry.c532
1 files changed, 267 insertions, 265 deletions
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index 1cd63c4bdfe..6441c6d7a39 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -22,7 +22,6 @@
* \ingroup blenloader
*/
-
#include <stddef.h>
#include <stdlib.h>
@@ -41,7 +40,6 @@
#include "DNA_genfile.h"
#include "DNA_sdna_types.h"
-
#include "BKE_main.h"
#include "BKE_idcode.h"
@@ -51,7 +49,7 @@
#include "readfile.h"
-#include "BLI_sys_types.h" // needed for intptr_t
+#include "BLI_sys_types.h" // needed for intptr_t
#ifdef WIN32
# include "BLI_winstuff.h"
@@ -71,11 +69,11 @@ void BLO_blendhandle_print_sizes(BlendHandle *, void *);
*/
BlendHandle *BLO_blendhandle_from_file(const char *filepath, ReportList *reports)
{
- BlendHandle *bh;
+ BlendHandle *bh;
- bh = (BlendHandle *)blo_filedata_from_file(filepath, reports);
+ bh = (BlendHandle *)blo_filedata_from_file(filepath, reports);
- return bh;
+ return bh;
}
/**
@@ -87,41 +85,46 @@ BlendHandle *BLO_blendhandle_from_file(const char *filepath, ReportList *reports
*/
BlendHandle *BLO_blendhandle_from_memory(const void *mem, int memsize)
{
- BlendHandle *bh;
+ BlendHandle *bh;
- bh = (BlendHandle *)blo_filedata_from_memory(mem, memsize, NULL);
+ bh = (BlendHandle *)blo_filedata_from_memory(mem, memsize, NULL);
- return bh;
+ return bh;
}
void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp)
{
- FileData *fd = (FileData *)bh;
- BHead *bhead;
-
- fprintf(fp, "[\n");
- for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
- if (bhead->code == ENDB)
- break;
- else {
- const short *sp = fd->filesdna->structs[bhead->SDNAnr];
- const char *name = fd->filesdna->types[sp[0]];
- char buf[4];
-
- buf[0] = (bhead->code >> 24) & 0xFF;
- buf[1] = (bhead->code >> 16) & 0xFF;
- buf[2] = (bhead->code >> 8) & 0xFF;
- buf[3] = (bhead->code >> 0) & 0xFF;
-
- buf[0] = buf[0] ? buf[0] : ' ';
- buf[1] = buf[1] ? buf[1] : ' ';
- buf[2] = buf[2] ? buf[2] : ' ';
- buf[3] = buf[3] ? buf[3] : ' ';
-
- fprintf(fp, "['%.4s', '%s', %d, %ld ],\n", buf, name, bhead->nr, (long int)(bhead->len + sizeof(BHead)));
- }
- }
- fprintf(fp, "]\n");
+ FileData *fd = (FileData *)bh;
+ BHead *bhead;
+
+ fprintf(fp, "[\n");
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
+ if (bhead->code == ENDB)
+ break;
+ else {
+ const short *sp = fd->filesdna->structs[bhead->SDNAnr];
+ const char *name = fd->filesdna->types[sp[0]];
+ char buf[4];
+
+ buf[0] = (bhead->code >> 24) & 0xFF;
+ buf[1] = (bhead->code >> 16) & 0xFF;
+ buf[2] = (bhead->code >> 8) & 0xFF;
+ buf[3] = (bhead->code >> 0) & 0xFF;
+
+ buf[0] = buf[0] ? buf[0] : ' ';
+ buf[1] = buf[1] ? buf[1] : ' ';
+ buf[2] = buf[2] ? buf[2] : ' ';
+ buf[3] = buf[3] ? buf[3] : ' ';
+
+ fprintf(fp,
+ "['%.4s', '%s', %d, %ld ],\n",
+ buf,
+ name,
+ bhead->nr,
+ (long int)(bhead->len + sizeof(BHead)));
+ }
+ }
+ fprintf(fp, "]\n");
}
/**
@@ -134,24 +137,24 @@ void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp)
*/
LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype, int *tot_names)
{
- FileData *fd = (FileData *)bh;
- LinkNode *names = NULL;
- BHead *bhead;
- int tot = 0;
-
- for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
- if (bhead->code == ofblocktype) {
- const char *idname = blo_bhead_id_name(fd, bhead);
-
- BLI_linklist_prepend(&names, strdup(idname + 2));
- tot++;
- }
- else if (bhead->code == ENDB)
- break;
- }
-
- *tot_names = tot;
- return names;
+ FileData *fd = (FileData *)bh;
+ LinkNode *names = NULL;
+ BHead *bhead;
+ int tot = 0;
+
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
+ if (bhead->code == ofblocktype) {
+ const char *idname = blo_bhead_id_name(fd, bhead);
+
+ BLI_linklist_prepend(&names, strdup(idname + 2));
+ tot++;
+ }
+ else if (bhead->code == ENDB)
+ break;
+ }
+
+ *tot_names = tot;
+ return names;
}
/**
@@ -164,84 +167,83 @@ LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype,
*/
LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *tot_prev)
{
- FileData *fd = (FileData *)bh;
- LinkNode *previews = NULL;
- BHead *bhead;
- int looking = 0;
- PreviewImage *prv = NULL;
- PreviewImage *new_prv = NULL;
- int tot = 0;
-
- for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
- if (bhead->code == ofblocktype) {
- const char *idname = blo_bhead_id_name(fd, bhead);
- switch (GS(idname)) {
- case ID_MA: /* fall through */
- case ID_TE: /* fall through */
- case ID_IM: /* fall through */
- case ID_WO: /* fall through */
- case ID_LA: /* fall through */
- case ID_OB: /* fall through */
- case ID_GR: /* fall through */
- case ID_SCE: /* fall through */
- new_prv = MEM_callocN(sizeof(PreviewImage), "newpreview");
- BLI_linklist_prepend(&previews, new_prv);
- tot++;
- looking = 1;
- break;
- default:
- break;
- }
- }
- else if (bhead->code == DATA) {
- if (looking) {
- if (bhead->SDNAnr == DNA_struct_find_nr(fd->filesdna, "PreviewImage") ) {
- prv = BLO_library_read_struct(fd, bhead, "PreviewImage");
- if (prv) {
- memcpy(new_prv, prv, sizeof(PreviewImage));
- if (prv->rect[0] && prv->w[0] && prv->h[0]) {
- bhead = blo_bhead_next(fd, bhead);
- BLI_assert((new_prv->w[0] * new_prv->h[0] * sizeof(uint)) == bhead->len);
- new_prv->rect[0] = BLO_library_read_struct(fd, bhead, "PreviewImage Icon Rect");
- }
- else {
- /* This should not be needed, but can happen in 'broken' .blend files,
- * better handle this gracefully than crashing. */
- BLI_assert(prv->rect[0] == NULL && prv->w[0] == 0 && prv->h[0] == 0);
- new_prv->rect[0] = NULL;
- new_prv->w[0] = new_prv->h[0] = 0;
- }
-
- if (prv->rect[1] && prv->w[1] && prv->h[1]) {
- bhead = blo_bhead_next(fd, bhead);
- BLI_assert((new_prv->w[1] * new_prv->h[1] * sizeof(uint)) == bhead->len);
- new_prv->rect[1] = BLO_library_read_struct(fd, bhead, "PreviewImage Image Rect");
- }
- else {
- /* This should not be needed, but can happen in 'broken' .blend files,
- * better handle this gracefully than crashing. */
- BLI_assert(prv->rect[1] == NULL && prv->w[1] == 0 && prv->h[1] == 0);
- new_prv->rect[1] = NULL;
- new_prv->w[1] = new_prv->h[1] = 0;
- }
- MEM_freeN(prv);
- }
- }
- }
- }
- else if (bhead->code == ENDB) {
- break;
- }
- else {
- looking = 0;
- new_prv = NULL;
- prv = NULL;
- }
-
- }
-
- *tot_prev = tot;
- return previews;
+ FileData *fd = (FileData *)bh;
+ LinkNode *previews = NULL;
+ BHead *bhead;
+ int looking = 0;
+ PreviewImage *prv = NULL;
+ PreviewImage *new_prv = NULL;
+ int tot = 0;
+
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
+ if (bhead->code == ofblocktype) {
+ const char *idname = blo_bhead_id_name(fd, bhead);
+ switch (GS(idname)) {
+ case ID_MA: /* fall through */
+ case ID_TE: /* fall through */
+ case ID_IM: /* fall through */
+ case ID_WO: /* fall through */
+ case ID_LA: /* fall through */
+ case ID_OB: /* fall through */
+ case ID_GR: /* fall through */
+ case ID_SCE: /* fall through */
+ new_prv = MEM_callocN(sizeof(PreviewImage), "newpreview");
+ BLI_linklist_prepend(&previews, new_prv);
+ tot++;
+ looking = 1;
+ break;
+ default:
+ break;
+ }
+ }
+ else if (bhead->code == DATA) {
+ if (looking) {
+ if (bhead->SDNAnr == DNA_struct_find_nr(fd->filesdna, "PreviewImage")) {
+ prv = BLO_library_read_struct(fd, bhead, "PreviewImage");
+ if (prv) {
+ memcpy(new_prv, prv, sizeof(PreviewImage));
+ if (prv->rect[0] && prv->w[0] && prv->h[0]) {
+ bhead = blo_bhead_next(fd, bhead);
+ BLI_assert((new_prv->w[0] * new_prv->h[0] * sizeof(uint)) == bhead->len);
+ new_prv->rect[0] = BLO_library_read_struct(fd, bhead, "PreviewImage Icon Rect");
+ }
+ else {
+ /* This should not be needed, but can happen in 'broken' .blend files,
+ * better handle this gracefully than crashing. */
+ BLI_assert(prv->rect[0] == NULL && prv->w[0] == 0 && prv->h[0] == 0);
+ new_prv->rect[0] = NULL;
+ new_prv->w[0] = new_prv->h[0] = 0;
+ }
+
+ if (prv->rect[1] && prv->w[1] && prv->h[1]) {
+ bhead = blo_bhead_next(fd, bhead);
+ BLI_assert((new_prv->w[1] * new_prv->h[1] * sizeof(uint)) == bhead->len);
+ new_prv->rect[1] = BLO_library_read_struct(fd, bhead, "PreviewImage Image Rect");
+ }
+ else {
+ /* This should not be needed, but can happen in 'broken' .blend files,
+ * better handle this gracefully than crashing. */
+ BLI_assert(prv->rect[1] == NULL && prv->w[1] == 0 && prv->h[1] == 0);
+ new_prv->rect[1] = NULL;
+ new_prv->w[1] = new_prv->h[1] = 0;
+ }
+ MEM_freeN(prv);
+ }
+ }
+ }
+ }
+ else if (bhead->code == ENDB) {
+ break;
+ }
+ else {
+ looking = 0;
+ new_prv = NULL;
+ prv = NULL;
+ }
+ }
+
+ *tot_prev = tot;
+ return previews;
}
/**
@@ -252,29 +254,29 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
*/
LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh)
{
- FileData *fd = (FileData *)bh;
- GSet *gathered = BLI_gset_ptr_new("linkable_groups gh");
- LinkNode *names = NULL;
- BHead *bhead;
-
- for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
- if (bhead->code == ENDB) {
- break;
- }
- else if (BKE_idcode_is_valid(bhead->code)) {
- if (BKE_idcode_is_linkable(bhead->code)) {
- const char *str = BKE_idcode_to_name(bhead->code);
-
- if (BLI_gset_add(gathered, (void *)str)) {
- BLI_linklist_prepend(&names, strdup(str));
- }
- }
- }
- }
-
- BLI_gset_free(gathered, NULL);
-
- return names;
+ FileData *fd = (FileData *)bh;
+ GSet *gathered = BLI_gset_ptr_new("linkable_groups gh");
+ LinkNode *names = NULL;
+ BHead *bhead;
+
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
+ if (bhead->code == ENDB) {
+ break;
+ }
+ else if (BKE_idcode_is_valid(bhead->code)) {
+ if (BKE_idcode_is_linkable(bhead->code)) {
+ const char *str = BKE_idcode_to_name(bhead->code);
+
+ if (BLI_gset_add(gathered, (void *)str)) {
+ BLI_linklist_prepend(&names, strdup(str));
+ }
+ }
+ }
+ }
+
+ BLI_gset_free(gathered, NULL);
+
+ return names;
}
/**
@@ -284,9 +286,9 @@ LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh)
*/
void BLO_blendhandle_close(BlendHandle *bh)
{
- FileData *fd = (FileData *)bh;
+ FileData *fd = (FileData *)bh;
- blo_filedata_free(fd);
+ blo_filedata_free(fd);
}
/**********/
@@ -299,23 +301,22 @@ void BLO_blendhandle_close(BlendHandle *bh)
* \param reports: If the return value is NULL, errors indicating the cause of the failure.
* \return The data of the file.
*/
-BlendFileData *BLO_read_from_file(
- const char *filepath,
- eBLOReadSkip skip_flags,
- ReportList *reports)
+BlendFileData *BLO_read_from_file(const char *filepath,
+ eBLOReadSkip skip_flags,
+ ReportList *reports)
{
- BlendFileData *bfd = NULL;
- FileData *fd;
-
- fd = blo_filedata_from_file(filepath, reports);
- if (fd) {
- fd->reports = reports;
- fd->skip_flags = skip_flags;
- bfd = blo_read_file_internal(fd, filepath);
- blo_filedata_free(fd);
- }
-
- return bfd;
+ BlendFileData *bfd = NULL;
+ FileData *fd;
+
+ fd = blo_filedata_from_file(filepath, reports);
+ if (fd) {
+ fd->reports = reports;
+ fd->skip_flags = skip_flags;
+ bfd = blo_read_file_internal(fd, filepath);
+ blo_filedata_free(fd);
+ }
+
+ return bfd;
}
/**
@@ -327,23 +328,23 @@ BlendFileData *BLO_read_from_file(
* \param reports: If the return value is NULL, errors indicating the cause of the failure.
* \return The data of the file.
*/
-BlendFileData *BLO_read_from_memory(
- const void *mem, int memsize,
- eBLOReadSkip skip_flags,
- ReportList *reports)
+BlendFileData *BLO_read_from_memory(const void *mem,
+ int memsize,
+ eBLOReadSkip skip_flags,
+ ReportList *reports)
{
- BlendFileData *bfd = NULL;
- FileData *fd;
-
- fd = blo_filedata_from_memory(mem, memsize, reports);
- if (fd) {
- fd->reports = reports;
- fd->skip_flags = skip_flags;
- bfd = blo_read_file_internal(fd, "");
- blo_filedata_free(fd);
- }
-
- return bfd;
+ BlendFileData *bfd = NULL;
+ FileData *fd;
+
+ fd = blo_filedata_from_memory(mem, memsize, reports);
+ if (fd) {
+ fd->reports = reports;
+ fd->skip_flags = skip_flags;
+ bfd = blo_read_file_internal(fd, "");
+ blo_filedata_free(fd);
+ }
+
+ return bfd;
}
/**
@@ -352,100 +353,101 @@ BlendFileData *BLO_read_from_memory(
* \param oldmain: old main, from which we will keep libraries and other datablocks that should not have changed.
* \param filename: current file, only for retrieving library data.
*/
-BlendFileData *BLO_read_from_memfile(
- Main *oldmain, const char *filename, MemFile *memfile,
- eBLOReadSkip skip_flags,
- ReportList *reports)
+BlendFileData *BLO_read_from_memfile(Main *oldmain,
+ const char *filename,
+ MemFile *memfile,
+ eBLOReadSkip skip_flags,
+ ReportList *reports)
{
- BlendFileData *bfd = NULL;
- FileData *fd;
- ListBase old_mainlist;
+ BlendFileData *bfd = NULL;
+ FileData *fd;
+ ListBase old_mainlist;
- fd = blo_filedata_from_memfile(memfile, reports);
- if (fd) {
- fd->reports = reports;
- fd->skip_flags = skip_flags;
- BLI_strncpy(fd->relabase, filename, sizeof(fd->relabase));
+ fd = blo_filedata_from_memfile(memfile, reports);
+ if (fd) {
+ fd->reports = reports;
+ fd->skip_flags = skip_flags;
+ BLI_strncpy(fd->relabase, filename, sizeof(fd->relabase));
- /* clear ob->proxy_from pointers in old main */
- blo_clear_proxy_pointers_from_lib(oldmain);
+ /* clear ob->proxy_from pointers in old main */
+ blo_clear_proxy_pointers_from_lib(oldmain);
- /* separate libraries from old main */
- blo_split_main(&old_mainlist, oldmain);
- /* add the library pointers in oldmap lookup */
- blo_add_library_pointer_map(&old_mainlist, fd);
+ /* separate libraries from old main */
+ blo_split_main(&old_mainlist, oldmain);
+ /* add the library pointers in oldmap lookup */
+ blo_add_library_pointer_map(&old_mainlist, fd);
- /* makes lookup of existing images in old main */
- blo_make_image_pointer_map(fd, oldmain);
+ /* makes lookup of existing images in old main */
+ blo_make_image_pointer_map(fd, oldmain);
- /* makes lookup of existing light caches in old main */
- blo_make_scene_pointer_map(fd, oldmain);
+ /* makes lookup of existing light caches in old main */
+ blo_make_scene_pointer_map(fd, oldmain);
- /* makes lookup of existing video clips in old main */
- blo_make_movieclip_pointer_map(fd, oldmain);
+ /* makes lookup of existing video clips in old main */
+ blo_make_movieclip_pointer_map(fd, oldmain);
- /* make lookups of existing sound data in old main */
- blo_make_sound_pointer_map(fd, oldmain);
+ /* make lookups of existing sound data in old main */
+ blo_make_sound_pointer_map(fd, oldmain);
- /* removed packed data from this trick - it's internal data that needs saves */
+ /* removed packed data from this trick - it's internal data that needs saves */
- bfd = blo_read_file_internal(fd, filename);
+ bfd = blo_read_file_internal(fd, filename);
- /* ensures relinked light caches are not freed */
- blo_end_scene_pointer_map(fd, oldmain);
+ /* ensures relinked light caches are not freed */
+ blo_end_scene_pointer_map(fd, oldmain);
- /* ensures relinked images are not freed */
- blo_end_image_pointer_map(fd, oldmain);
+ /* ensures relinked images are not freed */
+ blo_end_image_pointer_map(fd, oldmain);
- /* ensures relinked movie clips are not freed */
- blo_end_movieclip_pointer_map(fd, oldmain);
+ /* ensures relinked movie clips are not freed */
+ blo_end_movieclip_pointer_map(fd, oldmain);
- /* ensures relinked sounds are not freed */
- blo_end_sound_pointer_map(fd, oldmain);
+ /* ensures relinked sounds are not freed */
+ blo_end_sound_pointer_map(fd, oldmain);
- /* Still in-use libraries have already been moved from oldmain to new mainlist,
- * but oldmain itself shall *never* be 'transferred' to new mainlist! */
- BLI_assert(old_mainlist.first == oldmain);
+ /* Still in-use libraries have already been moved from oldmain to new mainlist,
+ * but oldmain itself shall *never* be 'transferred' to new mainlist! */
+ BLI_assert(old_mainlist.first == oldmain);
- if (bfd && old_mainlist.first != old_mainlist.last) {
- /* Even though directly used libs have been already moved to new main, indirect ones have not.
- * This is a bit annoying, but we have no choice but to keep them all for now - means some now unused
- * data may remain in memory, but think we'll have to live with it. */
- Main *libmain, *libmain_next;
- Main *newmain = bfd->main;
- ListBase new_mainlist = {newmain, newmain};
+ if (bfd && old_mainlist.first != old_mainlist.last) {
+ /* Even though directly used libs have been already moved to new main, indirect ones have not.
+ * This is a bit annoying, but we have no choice but to keep them all for now - means some now unused
+ * data may remain in memory, but think we'll have to live with it. */
+ Main *libmain, *libmain_next;
+ Main *newmain = bfd->main;
+ ListBase new_mainlist = {newmain, newmain};
- for (libmain = oldmain->next; libmain; libmain = libmain_next) {
- libmain_next = libmain->next;
- /* Note that LIB_INDIRECT does not work with libraries themselves, so we use non-NULL parent
- * to detect indirect-linked ones... */
- if (libmain->curlib && (libmain->curlib->parent != NULL)) {
- BLI_remlink(&old_mainlist, libmain);
- BLI_addtail(&new_mainlist, libmain);
- }
- else {
+ for (libmain = oldmain->next; libmain; libmain = libmain_next) {
+ libmain_next = libmain->next;
+ /* Note that LIB_INDIRECT does not work with libraries themselves, so we use non-NULL parent
+ * to detect indirect-linked ones... */
+ if (libmain->curlib && (libmain->curlib->parent != NULL)) {
+ BLI_remlink(&old_mainlist, libmain);
+ BLI_addtail(&new_mainlist, libmain);
+ }
+ else {
#ifdef PRINT_DEBUG
- printf("Dropped Main for lib: %s\n", libmain->curlib->id.name);
+ printf("Dropped Main for lib: %s\n", libmain->curlib->id.name);
#endif
- }
- }
- /* In any case, we need to move all lib datablocks themselves - those are 'first level data',
- * getting rid of them would imply updating spaces & co to prevent invalid pointers access. */
- BLI_movelisttolist(&newmain->libraries, &oldmain->libraries);
+ }
+ }
+ /* In any case, we need to move all lib datablocks themselves - those are 'first level data',
+ * getting rid of them would imply updating spaces & co to prevent invalid pointers access. */
+ BLI_movelisttolist(&newmain->libraries, &oldmain->libraries);
- blo_join_main(&new_mainlist);
- }
+ blo_join_main(&new_mainlist);
+ }
- /* printf("Remaining mains/libs in oldmain: %d\n", BLI_listbase_count(&fd->old_mainlist) - 1); */
+ /* printf("Remaining mains/libs in oldmain: %d\n", BLI_listbase_count(&fd->old_mainlist) - 1); */
- /* That way, libs (aka mains) we did not reuse in new undone/redone state
- * will be cleared together with oldmain... */
- blo_join_main(&old_mainlist);
+ /* That way, libs (aka mains) we did not reuse in new undone/redone state
+ * will be cleared together with oldmain... */
+ blo_join_main(&old_mainlist);
- blo_filedata_free(fd);
- }
+ blo_filedata_free(fd);
+ }
- return bfd;
+ return bfd;
}
/**
@@ -455,13 +457,13 @@ BlendFileData *BLO_read_from_memfile(
*/
void BLO_blendfiledata_free(BlendFileData *bfd)
{
- if (bfd->main) {
- BKE_main_free(bfd->main);
- }
+ if (bfd->main) {
+ BKE_main_free(bfd->main);
+ }
- if (bfd->user) {
- MEM_freeN(bfd->user);
- }
+ if (bfd->user) {
+ MEM_freeN(bfd->user);
+ }
- MEM_freeN(bfd);
+ MEM_freeN(bfd);
}