util: Remove the macro DEBUG_GET_ONCE_FILE_OPTION

DEBUG_GET_ONCE_FILE_OPTION is not a truly once function, it's return a new
FILE* object when calling to it when the conditions are satisfied. And it's
functional can be replaced with DEBUG_GET_ONCE_OPTION properly.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18323>
This commit is contained in:
Yonggang Luo
2022-09-01 22:23:05 +08:00
committed by Marge Bot
parent 5229a147c1
commit 3f18709f1f

View File

@@ -427,29 +427,6 @@ __check_suid(void)
return false;
}
/**
* Define a getter for a debug option which specifies a 'FILE *'
* to open, with additional checks for suid executables. Note
* that if the return is not NULL, the caller owns the 'FILE *'
* reference.
*/
#define DEBUG_GET_ONCE_FILE_OPTION(suffix, name, dfault, mode) \
static FILE * \
debug_get_option_ ## suffix (void) \
{ \
static bool initialized = false; \
static const char * value; \
if (__check_suid()) \
return NULL; \
if (!initialized) { \
initialized = true; \
value = debug_get_option(name, dfault); \
} \
if (!value) \
return NULL; \
return fopen(value, mode); \
}
#define DEBUG_GET_ONCE_BOOL_OPTION(sufix, name, dfault) \
static bool \
debug_get_option_ ## sufix (void) \