Skip to content

lib: fix handling of missing const type qualifiers.#452

Open
heitbaum wants to merge 1 commit intothom311:mainfrom
heitbaum:const
Open

lib: fix handling of missing const type qualifiers.#452
heitbaum wants to merge 1 commit intothom311:mainfrom
heitbaum:const

Conversation

@heitbaum
Copy link
Contributor

@heitbaum heitbaum commented Feb 8, 2026

For ISO C23, the functions strstr and strpbrk 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.

Update to const type for variabkes, as returned string is only used in comparisons which const can be used.

fixes:

../lib/route/classid.c: In function 'rtnl_tc_str2handle':
../lib/route/classid.c:187:37: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  187 |                         if (!(colon = strpbrk(str, ":"))) {
      |                                     ^
../lib/route/qdisc/netem.c: In function 'rtnl_netem_set_delay_distribution':
../lib/route/qdisc/netem.c:961:21: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  961 |         test_suffix = strstr(dist_type, dist_suffix);
      |                     ^

For ISO C23, the functions strstr and strpbrk 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.

Update to const type for variabkes, as returned string is only used in
comparisons which const can be used.

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant