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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2014-07-25 14:22:58 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2014-07-25 14:24:24 +0400
commitaf585e843b0a01399526d097c89fcbfbc216765c (patch)
treec0c6d9c0e44842623029b6c04dc0a55865f222fe /intern/guardedalloc
parentc0a9337caab2a2ae40959bac4a97830badbe593d (diff)
Fix inconsistent use of print_error() and fprintf(stderr, ...) in MEM_guarded_printmemlist_internal().
Also extended the size of buf[] in print_error() to prevent mem_printmemlist_pydict_script[] from getting truncated when MEM_printmemlist_pydict() is used. Differential revision: https://developer.blender.org/D675 Reviewed by: Campbell Barton
Diffstat (limited to 'intern/guardedalloc')
-rw-r--r--intern/guardedalloc/intern/mallocn_guarded_impl.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/intern/guardedalloc/intern/mallocn_guarded_impl.c b/intern/guardedalloc/intern/mallocn_guarded_impl.c
index 6e32844e2e7..10781a9cc54 100644
--- a/intern/guardedalloc/intern/mallocn_guarded_impl.c
+++ b/intern/guardedalloc/intern/mallocn_guarded_impl.c
@@ -231,7 +231,7 @@ __attribute__ ((format(printf, 1, 2)))
#endif
static void print_error(const char *str, ...)
{
- char buf[512];
+ char buf[1024];
va_list ap;
va_start(ap, str);
@@ -239,7 +239,10 @@ static void print_error(const char *str, ...)
va_end(ap);
buf[sizeof(buf) - 1] = '\0';
- if (error_callback) error_callback(buf);
+ if (error_callback)
+ error_callback(buf);
+ else
+ fputs(buf, stderr);
}
static void mem_lock_thread(void)
@@ -794,11 +797,10 @@ static void MEM_guarded_printmemlist_internal(int pydict)
}
while (membl) {
if (pydict) {
- fprintf(stderr,
- " {'len':" SIZET_FORMAT ", "
- "'name':'''%s''', "
- "'pointer':'%p'},\n",
- SIZET_ARG(membl->len), membl->name, (void *)(membl + 1));
+ print_error(" {'len':" SIZET_FORMAT ", "
+ "'name':'''%s''', "
+ "'pointer':'%p'},\n",
+ SIZET_ARG(membl->len), membl->name, (void *)(membl + 1));
}
else {
#ifdef DEBUG_MEMCOUNTER
@@ -818,8 +820,8 @@ static void MEM_guarded_printmemlist_internal(int pydict)
else break;
}
if (pydict) {
- fprintf(stderr, "]\n\n");
- fprintf(stderr, mem_printmemlist_pydict_script);
+ print_error("]\n\n");
+ print_error(mem_printmemlist_pydict_script);
}
mem_unlock_thread();