Re: [RFC][PATCH] grep: enable threading for context line printing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Mar 14, 2010 at 19:18, René Scharfe <rene.scharfe@xxxxxxxxxxxxxx> wrote:
> This patch makes work_done() in builtin/grep.c print hunk marks between
> files if threading is used, while show_line() in grep.c still does the
> same in the other case.  The latter is  controlled by the struct grep_opt
> member show_hunk_mark: 0 means show_line() prints no hunk marks between
> files, 1 means it prints them before the next file with matches and 2
> means it prints them before matches from the current file.
>
> Having two places for this is a bit ugly but it enables parallel grep
> for the common -ABC options.  Locking should be fine in add_work().
>
> Comments?

The implementation looks correct. As you say it is a bit ugly, but I
think it is worth it anyway. (The solutions I managed to come up with
when I wrote the original threaded grep patch were even uglier, that
is why I simply disabled the threading in that case.)

Symbolic constants for the magic values 0, 1, and 2 would make the
code more readable.

- Fredrik
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]