Type, util: add constexpr to static variables

This allows the compiler to move them to section `.rodata`.
This commit is contained in:
Max Kellermann 2020-01-22 13:50:05 +01:00
parent 2694b4e2c8
commit aacf84e552
2 changed files with 2 additions and 2 deletions

View file

@ -19,7 +19,7 @@ BroType::TypeAliasMap BroType::type_aliases;
// Note: This function must be thread-safe.
const char* type_name(TypeTag t)
{
static const char* type_names[int(NUM_TYPES)] = {
static constexpr const char* type_names[int(NUM_TYPES)] = {
"void", // 0
"bool", // 1
"int", // 2

View file

@ -612,7 +612,7 @@ TEST_CASE("util uitoa_n")
char* uitoa_n(uint64_t value, char* str, int n, int base, const char* prefix)
{
static char dig[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
static constexpr char dig[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
assert(n);