Fix discard const qualifier

description

Since glibc-2.43 and 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 input argument is a pointer to a const-qualified type.

n_end pointer returns are only being used for comparisons so declare them as const, which matches the input variable. n_start was already declares as const, so matching logic.

Fixes:

../../../lib/minitasn1/parser_aux.c: In function 'asn1_find_node':
../../../lib/minitasn1/parser_aux.c:148:13: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qu
alifiers]
  148 |       n_end = strchr (n_start, '.');    /* search the first dot */
      |             ^
../../../lib/minitasn1/parser_aux.c:189:13: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qu
alifiers]
  189 |       n_end = strchr (n_start, '.');    /* search the next dot */
      |             ^

This PR is in addition to gnutls!2073 (merged)

Checklist

  • Code modified for feature
  • Test suite updated with functionality tests
  • Test suite updated with negative tests
  • Documentation updated

Reviewer's checklist:

  • There is a test suite reasonably covering new functionality or modifications
  • Function naming, parameters, return values, types, etc., are consistent with other code
  • This feature/change has adequate documentation added
  • No obvious mistakes in the code

Merge request reports

Loading