mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 15:20:17 +01:00
gallium/util: add DEBUG_GET_ONCE_OPTION
This is analogous to the alreading existing macros for BOOL, NUM, and FLAGS. Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
parent
da0e216e06
commit
4711170239
1 changed files with 13 additions and 0 deletions
|
|
@ -404,6 +404,19 @@ debug_get_flags_option(const char *name,
|
|||
const struct debug_named_value *flags,
|
||||
uint64_t dfault);
|
||||
|
||||
#define DEBUG_GET_ONCE_OPTION(suffix, name, dfault) \
|
||||
static const char * \
|
||||
debug_get_option_ ## suffix (void) \
|
||||
{ \
|
||||
static boolean first = TRUE; \
|
||||
static const char * value; \
|
||||
if (first) { \
|
||||
first = FALSE; \
|
||||
value = debug_get_option(name, dfault); \
|
||||
} \
|
||||
return value; \
|
||||
}
|
||||
|
||||
#define DEBUG_GET_ONCE_BOOL_OPTION(sufix, name, dfault) \
|
||||
static boolean \
|
||||
debug_get_option_ ## sufix (void) \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue