Date: Fri, 20 Apr 2018 03:29:06 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332809 - head/usr.bin/grep Message-ID: <201804200329.w3K3T66M024833@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Fri Apr 20 03:29:06 2018 New Revision: 332809 URL: https://svnweb.freebsd.org/changeset/base/332809 Log: bsdgrep: Add some TODOs for future work on operating on chunks Modified: head/usr.bin/grep/util.c Modified: head/usr.bin/grep/util.c ============================================================================== --- head/usr.bin/grep/util.c Fri Apr 20 03:23:19 2018 (r332808) +++ head/usr.bin/grep/util.c Fri Apr 20 03:29:06 2018 (r332809) @@ -65,6 +65,7 @@ static bool first_match = true; */ struct parsec { regmatch_t matches[MAX_MATCHES]; /* Matches made */ + /* XXX TODO: This should be a chunk, not a line */ struct str ln; /* Current line */ size_t lnstart; /* Position in line */ size_t matchidx; /* Latest match index */ @@ -217,6 +218,10 @@ static bool procmatches(struct mprintc *mc, struct parsec *pc, bool matched) { + /* + * XXX TODO: This should loop over pc->matches and handle things on a + * line-by-line basis, setting up a `struct str` as needed. + */ /* Deal with any -B context or context separators */ if (matched) { if (mc->doctx) { @@ -327,12 +332,18 @@ procfile(const char *fn) mcount = mlimit; for (c = 0; c == 0 || !(lflag || qflag); ) { + /* + * XXX TODO: We need to revisit this in a chunking world. We're + * not going to be doing per-line statistics because of the + * overhead involved. procmatches can figure that stuff out as + * needed. */ /* Reset per-line statistics */ pc.printed = 0; pc.matchidx = 0; pc.lnstart = 0; pc.ln.boff = 0; pc.ln.off += pc.ln.len + 1; + /* XXX TODO: Grab a chunk */ if ((pc.ln.dat = grep_fgetln(f, &pc.ln.len)) == NULL || pc.ln.len == 0) break; @@ -587,6 +598,7 @@ procline(struct parsec *pc) continue; } + /* XXX TODO: We will need to keep going, since we're chunky */ /* One pass if we are not recording matches */ if (!wflag && ((color == NULL && !oflag) || qflag || lflag || Lflag)) break;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804200329.w3K3T66M024833>