mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-07-03 18:21:16 -03:00
Convert constant macros to constexpr expressions
Also convert some `const[expr] static xxx` to `const[expr] xxx` where it makes sense to let the compiler deduce on its own whether or not to allocate storage for a constant variable rather than imposing our view that it should have STATIC storage set aside for it. A few call sites were not making use of the `XXX_LEN` definitions and were calling `strlen(XXX)` - these have been updated to use `const_strlen(XXX)` instead. I'm not sure if any toolchains will have raise any issues with these changes... CI will tell!
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
#include "wutil.h" // IWYU pragma: keep
|
||||
|
||||
/// A name for our own key mapping for nul.
|
||||
static const wchar_t *k_nul_mapping_name = L"nul";
|
||||
constexpr const wchar_t k_nul_mapping_name[] = L"nul";
|
||||
|
||||
/// Struct representing a keybinding. Returned by input_get_mappings.
|
||||
struct input_mapping_t {
|
||||
@@ -72,7 +72,7 @@ struct terminfo_mapping_t {
|
||||
terminfo_mapping_t(const wchar_t *name, std::string s) : name(name), seq(std::move(s)) {}
|
||||
};
|
||||
|
||||
static constexpr size_t input_function_count = R_END_INPUT_FUNCTIONS;
|
||||
constexpr size_t input_function_count = R_END_INPUT_FUNCTIONS;
|
||||
|
||||
/// Input function metadata. This list should be kept in sync with the key code list in
|
||||
/// input_common.h.
|
||||
|
||||
Reference in New Issue
Block a user