From 3f18709f1f9722891c836812875cb0816c578236 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Thu, 1 Sep 2022 22:23:05 +0800 Subject: [PATCH] util: Remove the macro DEBUG_GET_ONCE_FILE_OPTION MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Acked-by: Marek Olšák Reviewed-by: Chia-I Wu Part-of: --- src/util/u_debug.h | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/util/u_debug.h b/src/util/u_debug.h index c1734e59426..1b91f657092 100644 --- a/src/util/u_debug.h +++ b/src/util/u_debug.h @@ -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) \