LibC: Remove static from function local constexpr variable

Problem:
- Function local `constexpr` variables do not need to be
  `static`. This consumes memory which is unnecessary and can prevent
  some optimizations.

Solution:
- Remove `static` keyword.
This commit is contained in:
Lenny Maiorani 2021-05-17 16:52:33 -06:00 committed by Andreas Kling
parent 44a9c7c23e
commit 31d24d8292
Notes: sideshowbarker 2024-07-18 17:53:33 +09:00
2 changed files with 2 additions and 2 deletions

View file

@ -165,7 +165,7 @@ inline int generate_unique_filename(char* pattern, Callback callback)
size_t start = length - 6;
static constexpr char random_characters[] = "abcdefghijklmnopqrstuvwxyz0123456789";
constexpr char random_characters[] = "abcdefghijklmnopqrstuvwxyz0123456789";
for (int attempt = 0; attempt < 100; ++attempt) {
for (int i = 0; i < 6; ++i)

View file

@ -21,7 +21,7 @@ static char* generate_random_filename(const char* pattern)
char* new_filename = strdup(pattern);
int pattern_length = strlen(pattern);
static constexpr char random_characters[] = "abcdefghijklmnopqrstuvwxyz0123456789";
constexpr char random_characters[] = "abcdefghijklmnopqrstuvwxyz0123456789";
for (auto i = pattern_length - 1; i >= 0; --i) {
if (pattern[i] != 'X')
break;