From: Keith Whitwell Date: Sat, 17 Jan 2009 18:45:20 +0000 (+0000) Subject: debug: add noprefix version of debug_dump_enum X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8f3fac6107460b6d9b011b5c76246468bb16004b;p=mesa.git debug: add noprefix version of debug_dump_enum --- diff --git a/src/gallium/auxiliary/util/p_debug.c b/src/gallium/auxiliary/util/p_debug.c index acdfa211c84..f373f941dd8 100644 --- a/src/gallium/auxiliary/util/p_debug.c +++ b/src/gallium/auxiliary/util/p_debug.c @@ -405,6 +405,32 @@ debug_dump_enum(const struct debug_named_value *names, } +const char * +debug_dump_enum_noprefix(const struct debug_named_value *names, + const char *prefix, + unsigned long value) +{ + static char rest[64]; + + while(names->name) { + if(names->value == value) { + const char *name = names->name; + while (*name == *prefix) { + name++; + prefix++; + } + return name; + } + ++names; + } + + + + util_snprintf(rest, sizeof(rest), "0x%08lx", value); + return rest; +} + + const char * debug_dump_flags(const struct debug_named_value *names, unsigned long value) diff --git a/src/gallium/include/pipe/p_debug.h b/src/gallium/include/pipe/p_debug.h index 3b00fb9aa89..e9c95982dda 100644 --- a/src/gallium/include/pipe/p_debug.h +++ b/src/gallium/include/pipe/p_debug.h @@ -261,6 +261,11 @@ const char * debug_dump_enum(const struct debug_named_value *names, unsigned long value); +const char * +debug_dump_enum_noprefix(const struct debug_named_value *names, + const char *prefix, + unsigned long value); + /** * Convert binary flags value to a string.