From: Nicolai Hähnle Date: Mon, 21 Dec 2015 21:11:37 +0000 (-0500) Subject: gallium/util: add DEBUG_GET_ONCE_OPTION X-Git-Tag: upstream/17.1.0~13538 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4711170239ae53c0fb06a4a0343cb3236fd882b7;p=platform%2Fupstream%2Fmesa.git 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 --- diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h index 5307072..34668f8 100644 --- a/src/gallium/auxiliary/util/u_debug.h +++ b/src/gallium/auxiliary/util/u_debug.h @@ -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) \