Module Name: src Committed By: rillig Date: Fri Mar 1 21:52:48 UTC 2024
Modified Files: src/usr.bin/xlint/lint1: ckgetopt.c cksnprintb.c emit1.c init.c lex.c tree.c Log Message: lint: fix misleading initializer for string iterator The field 'start' marks the start of the previous matching character, not the current iterator position. No binary change. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/usr.bin/xlint/lint1/ckgetopt.c cvs rdiff -u -r1.1 -r1.2 src/usr.bin/xlint/lint1/cksnprintb.c cvs rdiff -u -r1.87 -r1.88 src/usr.bin/xlint/lint1/emit1.c cvs rdiff -u -r1.259 -r1.260 src/usr.bin/xlint/lint1/init.c cvs rdiff -u -r1.219 -r1.220 src/usr.bin/xlint/lint1/lex.c cvs rdiff -u -r1.606 -r1.607 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/xlint/lint1/ckgetopt.c diff -u src/usr.bin/xlint/lint1/ckgetopt.c:1.23 src/usr.bin/xlint/lint1/ckgetopt.c:1.24 --- src/usr.bin/xlint/lint1/ckgetopt.c:1.23 Mon Feb 5 23:11:22 2024 +++ src/usr.bin/xlint/lint1/ckgetopt.c Fri Mar 1 21:52:48 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ckgetopt.c,v 1.23 2024/02/05 23:11:22 rillig Exp $ */ +/* $NetBSD: ckgetopt.c,v 1.24 2024/03/01 21:52:48 rillig Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: ckgetopt.c,v 1.23 2024/02/05 23:11:22 rillig Exp $"); +__RCSID("$NetBSD: ckgetopt.c,v 1.24 2024/03/01 21:52:48 rillig Exp $"); #endif #include <stdbool.h> @@ -105,7 +105,7 @@ is_getopt_condition(const tnode_t *tn, c && (str = last_arg->tn_left->tn_left->tn_string)->data != NULL) { buffer buf; buf_init(&buf); - quoted_iterator it = { .start = 0 }; + quoted_iterator it = { .i = 0 }; while (quoted_next(str, &it)) buf_add_char(&buf, (char)it.value); *out_options = buf.data; Index: src/usr.bin/xlint/lint1/cksnprintb.c diff -u src/usr.bin/xlint/lint1/cksnprintb.c:1.1 src/usr.bin/xlint/lint1/cksnprintb.c:1.2 --- src/usr.bin/xlint/lint1/cksnprintb.c:1.1 Fri Mar 1 19:40:45 2024 +++ src/usr.bin/xlint/lint1/cksnprintb.c Fri Mar 1 21:52:48 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cksnprintb.c,v 1.1 2024/03/01 19:40:45 rillig Exp $ */ +/* $NetBSD: cksnprintb.c,v 1.2 2024/03/01 21:52:48 rillig Exp $ */ /*- * Copyright (c) 2024 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: cksnprintb.c,v 1.1 2024/03/01 19:40:45 rillig Exp $"); +__RCSID("$NetBSD: cksnprintb.c,v 1.2 2024/03/01 21:52:48 rillig Exp $"); #endif #include <stdbool.h> @@ -266,7 +266,7 @@ check_snprintb(const tnode_t *expr) if (!match_snprintb_call(expr->tn_call, &fmt, &value)) return; - quoted_iterator it = { .start = 0 }; + quoted_iterator it = { .i = 0 }; if (!quoted_next(fmt, &it)) { /* missing new-style '\177' or old-style number base */ warning(359); Index: src/usr.bin/xlint/lint1/emit1.c diff -u src/usr.bin/xlint/lint1/emit1.c:1.87 src/usr.bin/xlint/lint1/emit1.c:1.88 --- src/usr.bin/xlint/lint1/emit1.c:1.87 Thu Feb 8 20:45:20 2024 +++ src/usr.bin/xlint/lint1/emit1.c Fri Mar 1 21:52:48 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: emit1.c,v 1.87 2024/02/08 20:45:20 rillig Exp $ */ +/* $NetBSD: emit1.c,v 1.88 2024/03/01 21:52:48 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: emit1.c,v 1.87 2024/02/08 20:45:20 rillig Exp $"); +__RCSID("$NetBSD: emit1.c,v 1.88 2024/03/01 21:52:48 rillig Exp $"); #endif #include <stdlib.h> @@ -362,7 +362,7 @@ outcall(const tnode_t *tn, bool retval_u arg->tn_left->tn_string->data != NULL) { buffer buf; buf_init(&buf); - quoted_iterator it = { .start = 0 }; + quoted_iterator it = { .i = 0 }; while (quoted_next(arg->tn_left->tn_string, &it)) buf_add_char(&buf, (char)it.value); Index: src/usr.bin/xlint/lint1/init.c diff -u src/usr.bin/xlint/lint1/init.c:1.259 src/usr.bin/xlint/lint1/init.c:1.260 --- src/usr.bin/xlint/lint1/init.c:1.259 Thu Feb 8 20:45:20 2024 +++ src/usr.bin/xlint/lint1/init.c Fri Mar 1 21:52:48 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: init.c,v 1.259 2024/02/08 20:45:20 rillig Exp $ */ +/* $NetBSD: init.c,v 1.260 2024/03/01 21:52:48 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: init.c,v 1.259 2024/02/08 20:45:20 rillig Exp $"); +__RCSID("$NetBSD: init.c,v 1.260 2024/03/01 21:52:48 rillig Exp $"); #endif #include <stdlib.h> @@ -886,7 +886,7 @@ initialization_init_array_from_string(in size_t len = tn->tn_string->len; if (tn->tn_string->data != NULL) { - quoted_iterator it = { .start = 0 }; + quoted_iterator it = { .i = 0 }; for (len = 0; quoted_next(tn->tn_string, &it); len++) continue; } Index: src/usr.bin/xlint/lint1/lex.c diff -u src/usr.bin/xlint/lint1/lex.c:1.219 src/usr.bin/xlint/lint1/lex.c:1.220 --- src/usr.bin/xlint/lint1/lex.c:1.219 Fri Mar 1 17:14:34 2024 +++ src/usr.bin/xlint/lint1/lex.c Fri Mar 1 21:52:48 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: lex.c,v 1.219 2024/03/01 17:14:34 rillig Exp $ */ +/* $NetBSD: lex.c,v 1.220 2024/03/01 21:52:48 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: lex.c,v 1.219 2024/03/01 17:14:34 rillig Exp $"); +__RCSID("$NetBSD: lex.c,v 1.220 2024/03/01 21:52:48 rillig Exp $"); #endif #include <ctype.h> @@ -872,7 +872,7 @@ hex_escape: static void check_quoted(const buffer *buf, bool complete, char delim) { - quoted_iterator it = { .start = 0 }, prev = it; + quoted_iterator it = { .i = 0 }, prev = it; for (; quoted_next(buf, &it); prev = it) { if (it.missing_hex_digits) /* no hex digits follow \x */ @@ -950,7 +950,7 @@ lex_character_constant(void) size_t n = 0; uint64_t val = 0; - quoted_iterator it = { .start = 0 }; + quoted_iterator it = { .i = 0 }; while (quoted_next(buf, &it)) { val = (val << CHAR_SIZE) + it.value; n++; @@ -992,7 +992,7 @@ lex_wide_character_constant(void) static char wbuf[MB_LEN_MAX + 1]; size_t n = 0, nmax = MB_CUR_MAX; - quoted_iterator it = { .start = 0 }; + quoted_iterator it = { .i = 0 }; while (quoted_next(buf, &it)) { if (n < nmax) wbuf[n] = (char)it.value; @@ -1293,7 +1293,7 @@ lex_wide_string(void) buffer str; buf_init(&str); - quoted_iterator it = { .start = 0 }; + quoted_iterator it = { .i = 0 }; while (quoted_next(buf, &it)) buf_add_char(&str, (char)it.value); Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.606 src/usr.bin/xlint/lint1/tree.c:1.607 --- src/usr.bin/xlint/lint1/tree.c:1.606 Fri Mar 1 19:39:28 2024 +++ src/usr.bin/xlint/lint1/tree.c Fri Mar 1 21:52:48 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.606 2024/03/01 19:39:28 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.607 2024/03/01 21:52:48 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.606 2024/03/01 19:39:28 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.607 2024/03/01 21:52:48 rillig Exp $"); #endif #include <float.h> @@ -523,7 +523,7 @@ build_string(buffer *lit) { size_t value_len = lit->len; if (lit->data != NULL) { - quoted_iterator it = { .start = 0 }; + quoted_iterator it = { .i = 0 }; for (value_len = 0; quoted_next(lit, &it); value_len++) continue; }