Module Name: src Committed By: rillig Date: Thu Mar 13 06:49:49 UTC 2025
Modified Files: src/lib/libintl: gettext.c Log Message: libintl: fix lint warning about strchr effectively discarding 'const' To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/lib/libintl/gettext.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libintl/gettext.c diff -u src/lib/libintl/gettext.c:1.33 src/lib/libintl/gettext.c:1.34 --- src/lib/libintl/gettext.c:1.33 Sun Aug 18 17:46:24 2024 +++ src/lib/libintl/gettext.c Thu Mar 13 06:49:49 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: gettext.c,v 1.33 2024/08/18 17:46:24 christos Exp $ */ +/* $NetBSD: gettext.c,v 1.34 2025/03/13 06:49:49 rillig Exp $ */ /*- * Copyright (c) 2000, 2001 Citrus Project, @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: gettext.c,v 1.33 2024/08/18 17:46:24 christos Exp $"); +__RCSID("$NetBSD: gettext.c,v 1.34 2025/03/13 06:49:49 rillig Exp $"); #include <sys/param.h> #include <sys/stat.h> @@ -581,7 +581,7 @@ mapit(const char *path, struct domainbin struct mo *mo; size_t l, headerlen; unsigned int i; - char *v; + const char *value; struct mohandle *mohandle = &db->mohandle; if (mohandle->addr && mohandle->addr != MAP_FAILED && @@ -713,16 +713,16 @@ mapit(const char *path, struct domainbin /* grab MIME-header and charset field */ mohandle->mo.mo_header = lookup("", db, &headerlen); if (mohandle->mo.mo_header) - v = strstr(mohandle->mo.mo_header, "charset="); + value = strstr(mohandle->mo.mo_header, "charset="); else - v = NULL; - if (v) { - mohandle->mo.mo_charset = strdup(v + 8); + value = NULL; + if (value != NULL) { + mohandle->mo.mo_charset = strdup(value + 8); if (!mohandle->mo.mo_charset) goto fail; - v = strchr(mohandle->mo.mo_charset, '\n'); - if (v) - *v = '\0'; + char *newline = strchr(mohandle->mo.mo_charset, '\n'); + if (newline != NULL) + *newline = '\0'; } if (!mohandle->mo.mo_header || _gettext_parse_plural(&mohandle->mo.mo_plural,