[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34334] trunk/blender: misc edits, no functional changes

Campbell Barton ideasman42 at gmail.com
Sat Jan 15 16:48:47 CET 2011


Revision: 34334
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=34334
Author:   campbellbarton
Date:     2011-01-15 15:48:46 +0000 (Sat, 15 Jan 2011)
Log Message:
-----------
misc edits, no functional changes
- enabling/disabling no longer prints in the terminal unless in debug mode.
- remove 'header' struct from BLI_storage_types.h, from revision 2 and is not used.
- Add GCC property to guardedalloc to warn if the return value from allocation functions isn't used.

Revision Links:
--------------
    http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=2

Modified Paths:
--------------
    trunk/blender/intern/guardedalloc/MEM_guardedalloc.h
    trunk/blender/release/scripts/modules/bpy/utils.py
    trunk/blender/source/blender/blenlib/BLI_storage_types.h

Modified: trunk/blender/intern/guardedalloc/MEM_guardedalloc.h
===================================================================
--- trunk/blender/intern/guardedalloc/MEM_guardedalloc.h	2011-01-15 14:48:44 UTC (rev 34333)
+++ trunk/blender/intern/guardedalloc/MEM_guardedalloc.h	2011-01-15 15:48:46 UTC (rev 34334)
@@ -59,6 +59,13 @@
 #include "stdio.h" /* needed for FILE* */
 #include "BLO_sys_types.h" /* needed for uintptr_t */
 
+#ifdef __GNUC__
+#  define WARN_UNUSED  __attribute__((warn_unused_result))
+#else
+#  define WARN_UNUSED
+#endif
+
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -66,7 +73,7 @@
 	/** Returns the length of the allocated memory segment pointed at
 	 * by vmemh. If the pointer was not previously allocated by this
 	 * module, the result is undefined.*/
-	size_t MEM_allocN_len(void *vmemh);
+	size_t MEM_allocN_len(void *vmemh) WARN_UNUSED;
 
 	/**
 	 * Release memory previously allocatred by this module. 
@@ -82,30 +89,30 @@
 	/**
 	 * Duplicates a block of memory, and returns a pointer to the
 	 * newly allocated block.  */
-	void *MEM_dupallocN(void *vmemh);
+	void *MEM_dupallocN(void *vmemh) WARN_UNUSED;
 
 	/**
 	  * Reallocates a block of memory, and returns pointer to the newly
 	  * allocated block, the old one is freed. this is not as optimized
 	  * as a system realloc but just makes a new allocation and copies
 	  * over from existing memory. */
-	void *MEM_reallocN(void *vmemh, size_t len);
+	void *MEM_reallocN(void *vmemh, size_t len) WARN_UNUSED;
 
 	/**
 	 * Allocate a block of memory of size len, with tag name str. The
 	 * memory is cleared. The name must be static, because only a
 	 * pointer to it is stored ! */
-	void *MEM_callocN(size_t len, const char * str);
+	void *MEM_callocN(size_t len, const char * str) WARN_UNUSED;
 	
 	/** Allocate a block of memory of size len, with tag name str. The
 		* name must be a static, because only a pointer to it is stored !
 		* */
-	void *MEM_mallocN(size_t len, const char * str);
+	void *MEM_mallocN(size_t len, const char * str) WARN_UNUSED;
 	
 	/** Same as callocN, clears memory and uses mmap (disk cached) if supported.
 		Can be free'd with MEM_freeN as usual.
 		* */
-	void *MEM_mapallocN(size_t len, const char * str);
+	void *MEM_mapallocN(size_t len, const char * str) WARN_UNUSED;
 
 	/** Print a list of the names and sizes of all allocated memory
 	 * blocks. as a python dict for easy investigation */ 
@@ -148,7 +155,7 @@
 	void MEM_reset_peak_memory(void);
 
 	/*get the peak memory usage in bytes, including mmap allocations*/
-	uintptr_t MEM_get_peak_memory(void);
+	uintptr_t MEM_get_peak_memory(void) WARN_UNUSED;
 
 #ifndef NDEBUG
 const char *MEM_name_ptr(void *vmemh);

Modified: trunk/blender/release/scripts/modules/bpy/utils.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy/utils.py	2011-01-15 14:48:44 UTC (rev 34333)
+++ trunk/blender/release/scripts/modules/bpy/utils.py	2011-01-15 15:48:46 UTC (rev 34334)
@@ -430,7 +430,8 @@
 
     mod.__addon_enabled__ = True
 
-    print("\tbpy.utils.addon_enable", mod.__name__)
+    if _bpy.app.debug:
+        print("\tbpy.utils.addon_enable", mod.__name__)
 
     return mod
 
@@ -469,7 +470,8 @@
             if addon:
                 addons.remove(addon)
 
-    print("\tbpy.utils.addon_disable", module_name)
+    if _bpy.app.debug:
+        print("\tbpy.utils.addon_disable", module_name)
 
 
 def addon_reset_all(reload_scripts=False):

Modified: trunk/blender/source/blender/blenlib/BLI_storage_types.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_storage_types.h	2011-01-15 14:48:44 UTC (rev 34333)
+++ trunk/blender/source/blender/blenlib/BLI_storage_types.h	2011-01-15 15:48:46 UTC (rev 34334)
@@ -35,16 +35,6 @@
 
 #include <sys/stat.h>
 
-#define HDRSIZE 512
-#define NAMSIZE 200
-
-struct header{
-	char	name[NAMSIZE];
-	unsigned int	size;
-	unsigned int	chksum;
-	char	fill[HDRSIZE-NAMSIZE-2*sizeof(unsigned int)];
-};
-
 #if defined(WIN32) && !defined(FREE_WINDOWS)
 typedef unsigned int mode_t;
 #endif




More information about the Bf-blender-cvs mailing list