svn commit: r316489 - head/usr.bin/grep

Ed Maste emaste at FreeBSD.org
Tue Apr 4 13:34:20 UTC 2017


Author: emaste
Date: Tue Apr  4 13:34:19 2017
New Revision: 316489
URL: https://svnweb.freebsd.org/changeset/base/316489

Log:
  bsdgrep: Initialize vars to avoid a false positive GCC warning
  
  Reported by:	lwhsu
  MFC after:	1 month
  MFC with:	r316477

Modified:
  head/usr.bin/grep/util.c

Modified: head/usr.bin/grep/util.c
==============================================================================
--- head/usr.bin/grep/util.c	Tue Apr  4 13:18:56 2017	(r316488)
+++ head/usr.bin/grep/util.c	Tue Apr  4 13:34:19 2017	(r316489)
@@ -282,6 +282,9 @@ procline(struct str *l, int nottext)
 	int c = 0, m = 0, r = 0, lastmatches = 0, leflags = eflags;
 	int startm = 0;
 
+	/* Initialize to avoid a false positive warning from GCC. */
+	lastmatch.rm_so = lastmatch.rm_eo = 0;
+
 	/* Loop to process the whole line */
 	while (st <= l->len) {
 		lastmatches = 0;


More information about the svn-src-all mailing list