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:
@@ -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) \
|
||||
|
Reference in New Issue
Block a user