diff mbox series

main: remove static from const strlen

Message ID DM4PR14MB4880999FD3EB47469CAA8B02A8A62@DM4PR14MB4880.namprd14.prod.outlook.com (mailing list archive)
State Accepted, archived
Headers show
Series main: remove static from const strlen | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-alpine-ci-fetch success Fetch PR
prestwoj/iwd-ci-gitlint fail main: remove static from const strlen 3: B2 Line has trailing whitespace: "src/p2putil.c: In function 'p2p_get_random_string': " 4: B2 Line has trailing whitespace: " src/p2putil.c:2641:37: error: initializer element is not constant 2641 | " 5: B2 Line has trailing whitespace: " static const int set_size = strlen(CHARSET); | " 8: B1 Line exceeds max length (83>80): "The compiler inlines the const value. This is just to make gcc 14 happy on riscv64."
prestwoj/iwd-ci-fetch success Fetch PR
prestwoj/iwd-alpine-ci-setupell success Prep - Setup ELL
prestwoj/iwd-ci-setupell success Prep - Setup ELL
prestwoj/iwd-ci-incremental_build success Incremental build not run PASS
prestwoj/iwd-alpine-ci-makedistcheck success Make Distcheck
prestwoj/iwd-alpine-ci-incremental_build success Incremental build not run PASS
prestwoj/iwd-ci-build success Build - Configure
prestwoj/iwd-alpine-ci-build success Build - Configure
prestwoj/iwd-ci-clang success clang PASS
prestwoj/iwd-alpine-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-alpine-ci-makecheck success Make Check
prestwoj/iwd-ci-makecheck success Make Check
prestwoj/iwd-ci-makedistcheck success Make Distcheck
prestwoj/iwd-ci-testrunner success test-runner PASS

Commit Message

Kasper Kantz July 12, 2024, 4:08 a.m. UTC
src/p2putil.c: In function 'p2p_get_random_string':    
 src/p2putil.c:2641:37: error: initializer element is not constant     2641 | 
        static const int set_size = strlen(CHARSET);         |                
                     ^~~~~~

The compiler inlines the const value. This is just to make gcc 14 happy on riscv64.

---
 src/p2putil.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/p2putil.c b/src/p2putil.c
index d1f114d0..ef0f988c 100644
--- a/src/p2putil.c
+++ b/src/p2putil.c
@@ -2638,7 +2638,7 @@  void p2p_get_random_string(char *buf, size_t len)
 {
 #define CHARSET "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" \
 		"0123456789"
-	static const int set_size = strlen(CHARSET);
+	const int set_size = strlen(CHARSET);
 
 	l_getrandom(buf, len);