string-table: Introduce DECLARE_STRING_TABLE_LOOKUP() and friends
Let's introduce these for the following two reasons: - Using them makes sure the parameter names match between declaration and definition (if both use the corresponding macros). - They make sure developers can't forget the _const_ and _pure_ attributes for the declarations. This commit also includes some include sorting fixes
This commit is contained in:
committed by
Yu Watanabe
parent
daff8ea8bb
commit
aec52c1e6e
+1
-2
@@ -34,8 +34,7 @@ typedef enum LogLevel {
|
||||
_LOG_INVALID = -1,
|
||||
} LogLevel;
|
||||
|
||||
LogLevel log_level_from_string(const char *s) _pure_;
|
||||
const char* log_level_to_string(LogLevel l) _const_;
|
||||
DECLARE_STRING_TABLE_LOOKUP(log_level, LogLevel);
|
||||
|
||||
LogLevel log_get_max_level(void) _pure_;
|
||||
int log_set_max_level(LogLevel level);
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "cleanup-fundamental.h" /* IWYU pragma: export */
|
||||
#include "efi-fundamental.h" /* IWYU pragma: export */
|
||||
#include "macro-fundamental.h" /* IWYU pragma: export */
|
||||
#include "string-table-fundamental.h" /* IWYU pragma: export */
|
||||
|
||||
#if SD_BOOT
|
||||
/* uchar.h/wchar.h are not suitable for freestanding environments. */
|
||||
|
||||
@@ -41,5 +41,5 @@ void install_security_override(security_validator_t validator, const void *valid
|
||||
void uninstall_security_override(void);
|
||||
bool security_override_available(void);
|
||||
|
||||
const char* secure_boot_enroll_to_string(secure_boot_enroll e) _const_;
|
||||
const char* secure_boot_enroll_action_to_string(secure_boot_enroll_action e) _const_;
|
||||
DECLARE_STRING_TABLE_LOOKUP_TO_STRING(secure_boot_enroll, secure_boot_enroll);
|
||||
DECLARE_STRING_TABLE_LOOKUP_TO_STRING(secure_boot_enroll_action, secure_boot_enroll_action);
|
||||
|
||||
Reference in New Issue
Block a user