src: retain const qualifier from pointer
PATCH 1/1 src: retain const qualifier from pointer
Since glibc-2.43:
For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr, strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return pointers into their input arrays now have definitions as macros that return a pointer to a const-qualified type when the in put argument is a pointer to a const-qualified type.
https://lists.gnu.org/archive/html/info-gnu/2026-01/msg00005.html
fixes:
- warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
--- src/shared/shell.c | 20 +++++++++++--------- src/textfile.c | 3 ++- tools/hciattach_ath3k.c | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-)
src/shared/shell.c +11 -9
@@ -525,6 +525,7 @@ static int cmd_exec(const struct bt_shell_menu_entry *entry,wordexp_t w;size_t len;char *man, *opt; +const char *man2, *opt2;int flags =WRDE_NOCMD ;bool optargs = false;
@@ -547,24 +548,24 @@ static int cmd_exec(const struct bt_shell_menu_entry *entry, }/* Find last mandatory arguments */ - man =strrchr (entry->arg,'>' ); -if (!man) { + man2 =strrchr (entry->arg,'>' ); +if (!man2) { opt =strdup (entry->arg); goto optional; } - len = man - entry->arg; + len = man2 - entry->arg;if (entry->arg[0 ] =='<' ) man =strndup (entry->arg, len +1 );else {/* Find where mandatory arguments start */ - opt =strrchr (entry->arg,'<' ); + opt2 =strrchr (entry->arg,'<' );/* Skip if mandatory arguments are not in the right format */ -if (!opt || opt > man) { +if (!opt2 || opt2 > man2) { opt =strdup (entry->arg); goto optional; } - man =strndup (opt, man - opt +1 ); + man =strndup (opt2, man2 - opt2 +1 ); optargs = true; }
@@ -972,6 +973,7 @@ static char *cmd_generator(const char *text, int state)static bool default_menu_enabled, menu_enabled, submenu_enabled;static const struct bt_shell_menu *menu;char *cmd; +const char *cmd2;if (!state) { index =0 ;
@@ -1009,11 +1011,11 @@ static char *cmd_generator(const char *text, int state)if (cmd || menu != data.main)return cmd; - cmd =strrchr (text,'.' ); -if (!cmd) + cmd2 =strrchr (text,'.' ); +if (!cmd2)return NULL ; - menu =find_menu (text, cmd - text,NULL ); + menu =find_menu (text, cmd2 - text,NULL );if (!menu)return NULL ;
src/textfile.c +2 -1
@@ -68,7 +68,8 @@ int create_filename(char *str, size_t size, const char *fmt, ...)static int create_dirs (const char *filename,const mode_t mode) {struct stat st; -char dir[PATH_MAX +1 ], *prev, *next; +char dir[PATH_MAX +1 ]; +const char *prev, *next;int err; err =stat (filename, &st);
tools/hciattach_ath3k.c +1 -1
@@ -303,7 +303,7 @@ struct tag_info {static inline int update_char_count (const char *buf) { -char *end_ptr; +const char *end_ptr;if (strstr (buf,"[" ) == buf) { end_ptr =strstr (buf,"]" );
Signature · 1 line
2.51.0
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1051861
---Test result---
Test Summary:
CheckPatch PENDING 0.41 seconds GitLint PENDING 0.36 seconds BuildEll PASS 20.17 seconds BluezMake PASS 653.50 seconds MakeCheck PASS 18.47 seconds MakeDistcheck PASS 242.36 seconds CheckValgrind PASS 293.78 seconds CheckSmatch WARNING 350.62 seconds bluezmakeextell PASS 181.16 seconds IncrementalBuild PENDING 0.38 seconds ScanBuild PASS 1020.78 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 9 lines · On Sat, 7 Feb 2026 11:44:00 +0000 you wrote:
Since glibc-2.43:
For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr, strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return pointers into their input arrays now have definitions as macros that return a pointer to a const-qualified type when the in put argument is a pointer to a const-qualified type.
[...]
Here is the summary with links:
- src: retain const qualifier from pointer
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=450e99f0801f
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html