diff mbox series

main: remove static from const strlen

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

Checks

Context Check Description
tedd_an/pre-ci_am fail

Commit Message

Kasper Kantz July 12, 2024, 12:33 a.m. UTC
From bc0f427f81b5b25f1c706c66e455dc9ea5686266 Mon Sep 17 00:00:00 2001
From: kasper <kasperkantz@outlook.com>
Date: Fri, 12 Jul 2024 00:23:56 +0000
Subject: [PATCH] main: remove static from const strlen To fix this error:
 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);         |
 ^~~~~~

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

--
2.45.2

Comments

Denis Kenzior July 12, 2024, 4:09 p.m. UTC | #1
Hi,

On 7/11/24 7:33 PM, dangling . wrote:
>  From bc0f427f81b5b25f1c706c66e455dc9ea5686266 Mon Sep 17 00:00:00 2001
> From: kasper <kasperkantz@outlook.com>

I need a full name in order to accept this patch.

> Date: Fri, 12 Jul 2024 00:23:56 +0000
> Subject: [PATCH] main: remove static from const strlen To fix this error:
>   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);         |
>   ^~~~~~
> 
> ---
>   src/p2putil.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 

Why did you send 3 of the same one?

> 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);
> 
> --
> 2.45.2

Regards,
-Denis
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);