From owner-svn-src-head@freebsd.org Mon Apr 24 20:34:58 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 645A4D4E912; Mon, 24 Apr 2017 20:34:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CB95E26; Mon, 24 Apr 2017 20:34:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OKYvTC062715; Mon, 24 Apr 2017 20:34:57 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OKYvHl062714; Mon, 24 Apr 2017 20:34:57 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704242034.v3OKYvHl062714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 24 Apr 2017 20:34:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317381 - head/usr.bin/diff X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 20:34:58 -0000 Author: dim Date: Mon Apr 24 20:34:56 2017 New Revision: 317381 URL: https://svnweb.freebsd.org/changeset/base/317381 Log: Fix the following warning from gcc 4.2 in usr.bin/diff: usr.bin/diff/diffreg.c: In function 'change': usr.bin/diff/diffreg.c:1085: warning: 'i' may be used uninitialized in this function This version of gcc is not smart enough to see that 'i' cannot actually be used unitialized. However, the variable is confusingly re-used, so it is better to give it another name, and clearly initialize it before attempting to use it. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D10484 Modified: head/usr.bin/diff/diffreg.c Modified: head/usr.bin/diff/diffreg.c ============================================================================== --- head/usr.bin/diff/diffreg.c Mon Apr 24 18:35:25 2017 (r317380) +++ head/usr.bin/diff/diffreg.c Mon Apr 24 20:34:56 2017 (r317381) @@ -1082,7 +1082,7 @@ change(char *file1, FILE *f1, char *file { static size_t max_context = 64; long curpos; - int i, nc; + int i, nc, f; const char *walk; restart: @@ -1214,9 +1214,10 @@ proceed: if (a <= b && c <= d && diff_format == D_NORMAL) diff_output("---\n"); } + f = 0; if (diff_format != D_GFORMAT) - i = fetch(ixnew, c, d, f2, diff_format == D_NORMAL ? '>' : '\0', 0, *pflags); - if (i != 0 && diff_format == D_EDIT) { + f = fetch(ixnew, c, d, f2, diff_format == D_NORMAL ? '>' : '\0', 0, *pflags); + if (f != 0 && diff_format == D_EDIT) { /* * A non-zero return value for D_EDIT indicates that the * last line printed was a bare dot (".") that has been @@ -1225,10 +1226,10 @@ proceed: * back and restart where we left off. */ diff_output(".\n"); - diff_output("%ds/.//\n", a + i - 1); - b = a + i - 1; + diff_output("%ds/.//\n", a + f - 1); + b = a + f - 1; a = b + 1; - c += i; + c += f; goto restart; } if ((diff_format == D_EDIT || diff_format == D_REVERSE) && c <= d)