build: constify memchr()/strchr()/etc result variables

And a few variables around.

There remain cases where the accepted pointer is const, yet the returned
pointer is written to.

Partly addressing (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 input argument is
  a pointer to a const-qualified type.
```
Ref: https://lists.gnu.org/archive/html/info-gnu/2026-01/msg00005.html

Reported-by: Rudi Heitbaum
Ref: #20420

Closes #20421
This commit is contained in:
Viktor Szakats 2026-01-25 03:26:03 +01:00
parent 7dc60bdb90
commit 0e2507a3c6
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
22 changed files with 54 additions and 53 deletions

View file

@ -122,7 +122,7 @@ static NETRCcode parsenetrc(struct store_netrc *store,
any order */
bool our_login = FALSE; /* found our login name */
bool done = FALSE;
char *netrcbuffer;
const char *netrcbuffer;
struct dynbuf token;
struct dynbuf *filebuf = &store->filebuf;
DEBUGASSERT(!*passwordp);
@ -326,7 +326,7 @@ static NETRCcode parsenetrc(struct store_netrc *store,
tok = ++tok_end;
}
if(!done) {
char *nl = NULL;
const char *nl = NULL;
if(tok)
nl = strchr(tok, '\n');
if(!nl)