Re: [PATCH 4/4] grep -O: allow optional argument specifying the pager (or editor)

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

 



Jonathan Nieder <jrnieder@xxxxxxxxx> writes:

> diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
> index 8fdd8e1..d89ec32 100644
> --- a/Documentation/git-grep.txt
> +++ b/Documentation/git-grep.txt
> @@ -14,7 +14,7 @@ SYNOPSIS
>  	   [-E | --extended-regexp] [-G | --basic-regexp]
>  	   [-F | --fixed-strings] [-n]
>  	   [-l | --files-with-matches] [-L | --files-without-match]
> -	   [-O | --open-files-in-pager]
> +	   [(-O | --open-files-in-pager) [<pager>]]
>  	   [-z | --null]
>  	   [-c | --count] [--all-match] [-q | --quiet]
>  	   [--max-depth <depth>]

Hmm, does "git grep -e Heh -O frotz" look for Heh and show in the frotz
pager, or does it look for Heh in paths under frotz/ directory and show
hits in the default pager?

> diff --git a/builtin/grep.c b/builtin/grep.c
> index 1e8b946..f32fbbc 100644
> --- a/builtin/grep.c
> +++ b/builtin/grep.c
> @@ -828,7 +828,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
>  	int cached = 0;
>  	int seen_dashdash = 0;
>  	int external_grep_allowed__ignored;
> -	int show_in_pager = 0;
> +	const char *show_in_pager = NULL, *default_pager = "dummy";

If there were another instance of constant string "dummy" elsewhere in the
program, is a clever compiler-linker combo allowed to optimize memory use
by allocating one instance of such a string and pointing default_pager
pointer to it?  IOW, if the patch were:

> +	const char *show_in_pager = NULL, *default_pager = "dummy";
> +	const char *another_dummy = "dummy";

could another_dummy and default_pager start out with the same value?

This is just out of curiosity and does not affect correctness of the code,
but I am wondering...
--
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]