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:
Diffstat (limited to 'intern/guardedalloc/intern/mallocn.c')
-rw-r--r--intern/guardedalloc/intern/mallocn.c95
1 files changed, 49 insertions, 46 deletions
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c
index fb778da015a..1c96856fd0d 100644
--- a/intern/guardedalloc/intern/mallocn.c
+++ b/intern/guardedalloc/intern/mallocn.c
@@ -45,7 +45,9 @@ void *(*MEM_callocN)(size_t len, const char *str) = MEM_lockfree_callocN;
void *(*MEM_calloc_arrayN)(size_t len, size_t size, const char *str) = MEM_lockfree_calloc_arrayN;
void *(*MEM_mallocN)(size_t len, const char *str) = MEM_lockfree_mallocN;
void *(*MEM_malloc_arrayN)(size_t len, size_t size, const char *str) = MEM_lockfree_malloc_arrayN;
-void *(*MEM_mallocN_aligned)(size_t len, size_t alignment, const char *str) = MEM_lockfree_mallocN_aligned;
+void *(*MEM_mallocN_aligned)(size_t len,
+ size_t alignment,
+ const char *str) = MEM_lockfree_mallocN_aligned;
void *(*MEM_mapallocN)(size_t len, const char *str) = MEM_lockfree_mapallocN;
void (*MEM_printmemlist_pydict)(void) = MEM_lockfree_printmemlist_pydict;
void (*MEM_printmemlist)(void) = MEM_lockfree_printmemlist;
@@ -53,7 +55,8 @@ void (*MEM_callbackmemlist)(void (*func)(void *)) = MEM_lockfree_callbackmemlist
void (*MEM_printmemlist_stats)(void) = MEM_lockfree_printmemlist_stats;
void (*MEM_set_error_callback)(void (*func)(const char *)) = MEM_lockfree_set_error_callback;
bool (*MEM_consistency_check)(void) = MEM_lockfree_consistency_check;
-void (*MEM_set_lock_callback)(void (*lock)(void), void (*unlock)(void)) = MEM_lockfree_set_lock_callback;
+void (*MEM_set_lock_callback)(void (*lock)(void),
+ void (*unlock)(void)) = MEM_lockfree_set_lock_callback;
void (*MEM_set_memory_debug)(void) = MEM_lockfree_set_memory_debug;
size_t (*MEM_get_memory_in_use)(void) = MEM_lockfree_get_memory_in_use;
size_t (*MEM_get_mapped_memory_in_use)(void) = MEM_lockfree_get_mapped_memory_in_use;
@@ -68,66 +71,66 @@ const char *(*MEM_name_ptr)(void *vmemh) = MEM_lockfree_name_ptr;
void *aligned_malloc(size_t size, size_t alignment)
{
#ifdef _WIN32
- return _aligned_malloc(size, alignment);
+ return _aligned_malloc(size, alignment);
#elif defined(__APPLE__)
- /* On Mac OS X, both the heap and the stack are guaranteed 16-byte aligned so
- * they work natively with SSE types with no further work.
- */
- assert(alignment == 16);
- (void)alignment;
- return malloc(size);
+ /* On Mac OS X, both the heap and the stack are guaranteed 16-byte aligned so
+ * they work natively with SSE types with no further work.
+ */
+ assert(alignment == 16);
+ (void)alignment;
+ return malloc(size);
#elif defined(__FreeBSD__) || defined(__NetBSD__)
- void *result;
+ void *result;
- if (posix_memalign(&result, alignment, size)) {
- /* non-zero means allocation error
- * either no allocation or bad alignment value
- */
- return NULL;
- }
- return result;
-#else /* This is for Linux. */
- return memalign(alignment, size);
+ if (posix_memalign(&result, alignment, size)) {
+ /* non-zero means allocation error
+ * either no allocation or bad alignment value
+ */
+ return NULL;
+ }
+ return result;
+#else /* This is for Linux. */
+ return memalign(alignment, size);
#endif
}
void aligned_free(void *ptr)
{
#ifdef _WIN32
- _aligned_free(ptr);
+ _aligned_free(ptr);
#else
- free(ptr);
+ free(ptr);
#endif
}
void MEM_use_guarded_allocator(void)
{
- MEM_allocN_len = MEM_guarded_allocN_len;
- MEM_freeN = MEM_guarded_freeN;
- MEM_dupallocN = MEM_guarded_dupallocN;
- MEM_reallocN_id = MEM_guarded_reallocN_id;
- MEM_recallocN_id = MEM_guarded_recallocN_id;
- MEM_callocN = MEM_guarded_callocN;
- MEM_calloc_arrayN = MEM_guarded_calloc_arrayN;
- MEM_mallocN = MEM_guarded_mallocN;
- MEM_malloc_arrayN = MEM_guarded_malloc_arrayN;
- MEM_mallocN_aligned = MEM_guarded_mallocN_aligned;
- MEM_mapallocN = MEM_guarded_mapallocN;
- MEM_printmemlist_pydict = MEM_guarded_printmemlist_pydict;
- MEM_printmemlist = MEM_guarded_printmemlist;
- MEM_callbackmemlist = MEM_guarded_callbackmemlist;
- MEM_printmemlist_stats = MEM_guarded_printmemlist_stats;
- MEM_set_error_callback = MEM_guarded_set_error_callback;
- MEM_consistency_check = MEM_guarded_consistency_check;
- MEM_set_lock_callback = MEM_guarded_set_lock_callback;
- MEM_set_memory_debug = MEM_guarded_set_memory_debug;
- MEM_get_memory_in_use = MEM_guarded_get_memory_in_use;
- MEM_get_mapped_memory_in_use = MEM_guarded_get_mapped_memory_in_use;
- MEM_get_memory_blocks_in_use = MEM_guarded_get_memory_blocks_in_use;
- MEM_reset_peak_memory = MEM_guarded_reset_peak_memory;
- MEM_get_peak_memory = MEM_guarded_get_peak_memory;
+ MEM_allocN_len = MEM_guarded_allocN_len;
+ MEM_freeN = MEM_guarded_freeN;
+ MEM_dupallocN = MEM_guarded_dupallocN;
+ MEM_reallocN_id = MEM_guarded_reallocN_id;
+ MEM_recallocN_id = MEM_guarded_recallocN_id;
+ MEM_callocN = MEM_guarded_callocN;
+ MEM_calloc_arrayN = MEM_guarded_calloc_arrayN;
+ MEM_mallocN = MEM_guarded_mallocN;
+ MEM_malloc_arrayN = MEM_guarded_malloc_arrayN;
+ MEM_mallocN_aligned = MEM_guarded_mallocN_aligned;
+ MEM_mapallocN = MEM_guarded_mapallocN;
+ MEM_printmemlist_pydict = MEM_guarded_printmemlist_pydict;
+ MEM_printmemlist = MEM_guarded_printmemlist;
+ MEM_callbackmemlist = MEM_guarded_callbackmemlist;
+ MEM_printmemlist_stats = MEM_guarded_printmemlist_stats;
+ MEM_set_error_callback = MEM_guarded_set_error_callback;
+ MEM_consistency_check = MEM_guarded_consistency_check;
+ MEM_set_lock_callback = MEM_guarded_set_lock_callback;
+ MEM_set_memory_debug = MEM_guarded_set_memory_debug;
+ MEM_get_memory_in_use = MEM_guarded_get_memory_in_use;
+ MEM_get_mapped_memory_in_use = MEM_guarded_get_mapped_memory_in_use;
+ MEM_get_memory_blocks_in_use = MEM_guarded_get_memory_blocks_in_use;
+ MEM_reset_peak_memory = MEM_guarded_reset_peak_memory;
+ MEM_get_peak_memory = MEM_guarded_get_peak_memory;
#ifndef NDEBUG
- MEM_name_ptr = MEM_guarded_name_ptr;
+ MEM_name_ptr = MEM_guarded_name_ptr;
#endif
}