[Bf-blender-cvs] [db4a46b] master: Cleanup: hide debug print behind proper debug defines instead of using comments...

Bastien Montagne noreply at git.blender.org
Tue Jun 21 16:22:36 CEST 2016


Commit: db4a46bc3c97bf9762a472bb8dcd4213b69acf83
Author: Bastien Montagne
Date:   Tue Jun 21 16:19:08 2016 +0200
Branches: master
https://developer.blender.org/rBdb4a46bc3c97bf9762a472bb8dcd4213b69acf83

Cleanup: hide debug print behind proper debug defines instead of using comments...

===================================================================

M	source/blender/blenloader/intern/readblenentry.c
M	source/blender/blenloader/intern/readfile.c

===================================================================

diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index b5ba987..be89317 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -423,11 +423,11 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFil
 					BLI_remlink(&old_mainlist, libmain);
 					BLI_addtail(&new_mainlist, libmain);
 				}
-#if 0
 				else {
+#ifdef PRINT_DEBUG
 					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. */
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 838179e..6aa2fc4 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -7949,16 +7949,22 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
 	if (fd->memfile && ELEM(bhead->code, ID_LI, ID_ID)) {
 		const char *idname = bhead_id_name(fd, bhead);
 
-		/* printf("Checking %s...\n", idname); */
+#ifdef PRINT_DEBUG
+		printf("Checking %s...\n", idname);
+#endif
 
 		if (bhead->code == ID_LI) {
 			Main *libmain = fd->old_mainlist->first;
 			/* Skip oldmain itself... */
 			for (libmain = libmain->next; libmain; libmain = libmain->next) {
-				/* printf("... against %s: ", libmain->curlib ? libmain->curlib->id.name : "<NULL>"); */
+#ifdef PRINT_DEBUG
+				printf("... against %s: ", libmain->curlib ? libmain->curlib->id.name : "<NULL>");
+#endif
 				if (libmain->curlib && STREQ(idname, libmain->curlib->id.name)) {
 					Main *oldmain = fd->old_mainlist->first;
-					/* printf("FOUND!\n"); */
+#ifdef PRINT_DEBUG
+					printf("FOUND!\n");
+#endif
 					/* In case of a library, we need to re-add its main to fd->mainlist, because if we have later
 					 * a missing ID_ID, we need to get the correct lib it is linked to!
 					 * Order is crucial, we cannot bulk-add it in BLO_read_from_memfile() like it used to be... */
@@ -7972,13 +7978,19 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
 					}
 					return blo_nextbhead(fd, bhead);
 				}
-				/* printf("nothing...\n"); */
+#ifdef PRINT_DEBUG
+				printf("nothing...\n");
+#endif
 			}
 		}
 		else {
-			/* printf("... in %s (%s): ", main->curlib ? main->curlib->id.name : "<NULL>", main->curlib ? main->curlib->name : "<NULL>"); */
+#ifdef PRINT_DEBUG
+			printf("... in %s (%s): ", main->curlib ? main->curlib->id.name : "<NULL>", main->curlib ? main->curlib->name : "<NULL>");
+#endif
 			if ((id = BKE_libblock_find_name_ex(main, GS(idname), idname + 2))) {
-				/* printf("FOUND!\n"); */
+#ifdef PRINT_DEBUG
+				printf("FOUND!\n");
+#endif
 				/* Even though we found our linked ID, there is no guarantee its address is still the same... */
 				if (id != bhead->old) {
 					oldnewmap_insert(fd->libmap, bhead->old, id, GS(id->name));
@@ -7990,7 +8002,9 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
 				}
 				return blo_nextbhead(fd, bhead);
 			}
-			/* printf("nothing...\n"); */
+#ifdef PRINT_DEBUG
+			printf("nothing...\n");
+#endif
 		}
 	}




More information about the Bf-blender-cvs mailing list