git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git: make was_alias non-static

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Mar 1, 2015, 23:44 UTC
Message-ID
<CAPig+cQdFSjN55o7E_F-Xr4HCax+JwzxYG90N0n4UXxe3yxNcg@mail.gmail.com>
In-Reply-To
<1425192531-11951-1-git-send-email-kuleshovmail@gmail.com>

On Sun, Mar 1, 2015 at 1:48 AM, Alexander Kuleshov <kuleshovmail@gmail.com> wrote:

Show 17 quoted lines
> 'was_alias' variable does not need to store it's value each iteration in the
> loop, anyway this variable changes it's value with run_argv. So it does not
> need to be static.
>
> Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
> ---
>  git.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/git.c b/git.c
> index 1780233..b8b6520 100644
> --- a/git.c
> +++ b/git.c
> @@ -682,7 +682,7 @@ int main(int argc, char **av)
>
>         while (1) {
>                 static int done_help = 0;

'done_help' could receive similar treatment by dropping 'static' and moving it outside the 'while' loop. Doing so would make the logic easier to understand.

> -               static int was_alias = 0;
> +               int was_alias = 0;

No need for the 0 initialization since 'was_alias' is being assigned immediately below.

Show 5 quoted lines
>                 was_alias = run_argv(&argc, &argv);
>                 if (errno != ENOENT)
>                         break;
> --
> 2.3.1.422.ge618558.dirty
Previous: Alexander Kuleshov
Message 2 of 2 in “git: make was_alias non-static”
  1. git: make was_alias non-staticAlexander Kuleshov, Mar 1, 2015
  2. Eric SunshineMar 1, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.