Module Name:    src
Committed By:   rillig
Date:           Sun Oct  3 20:35:59 UTC 2021

Modified Files:
        src/usr.bin/indent: lexi.c

Log Message:
indent: fix lint warning about signed '>>'

Lint couldn't infer that indent's list of type names will practically
never contain more that 2 billion entries and that the result of '>>'
would be the same in all cases.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/usr.bin/indent/lexi.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/indent/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.64 src/usr.bin/indent/lexi.c:1.65
--- src/usr.bin/indent/lexi.c:1.64	Mon Sep 27 18:21:47 2021
+++ src/usr.bin/indent/lexi.c	Sun Oct  3 20:35:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lexi.c,v 1.64 2021/09/27 18:21:47 rillig Exp $	*/
+/*	$NetBSD: lexi.c,v 1.65 2021/10/03 20:35:59 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)lexi.c	8.1 (
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: lexi.c,v 1.64 2021/09/27 18:21:47 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.65 2021/10/03 20:35:59 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
 #endif
@@ -670,7 +670,7 @@ insert_pos(const char *key, const char *
     int hi = (int)len - 1;
 
     while (lo <= hi) {
-	int mid = (lo + hi) >> 1;
+	int mid = (int)((unsigned)(lo + hi) >> 1);
 	int cmp = strcmp(arr[mid], key);
 	if (cmp < 0)
 	    lo = mid + 1;

Reply via email to