From 6610e854a5cc39c6b4ffa6cc3b955a0cb2992696 Mon Sep 17 00:00:00 2001 From: jethead71 Date: Wed, 29 Dec 2010 20:03:47 +0000 Subject: [PATCH] Return thread ID as a string for name when a thread isn't named or name cannot be used, as comment says, not slot pointer. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28928 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/hosted/sdl/thread-sdl.c | 4 ++-- firmware/thread.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/firmware/target/hosted/sdl/thread-sdl.c b/firmware/target/hosted/sdl/thread-sdl.c index 83f1d1960..08f20367c 100644 --- a/firmware/target/hosted/sdl/thread-sdl.c +++ b/firmware/target/hosted/sdl/thread-sdl.c @@ -670,9 +670,9 @@ void thread_get_name(char *buffer, int size, { /* Display thread name if one or ID if none */ bool named = thread->name && *thread->name; - const char *fmt = named ? "%s" : "%08lX"; + const char *fmt = named ? "%s" : "%04lX"; intptr_t name = named ? - (intptr_t)thread->name : (intptr_t)thread; + (intptr_t)thread->name : (intptr_t)thread->id; snprintf(buffer, size, fmt, name); } } diff --git a/firmware/thread.c b/firmware/thread.c index 24bbb317f..b71bc1749 100644 --- a/firmware/thread.c +++ b/firmware/thread.c @@ -2379,8 +2379,8 @@ void thread_get_name(char *buffer, int size, const char *fmt = "%s"; if (name == NULL IF_COP(|| name == THREAD_DESTRUCT) || *name == '\0') { - name = (const char *)thread; - fmt = "%08lX"; + name = (const char *)(unsigned int)thread->id; + fmt = "%04lX"; } snprintf(buffer, size, fmt, name); } -- 2.11.4.GIT