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

2015-03-01 Thread Eric Sunshine
On Sun, Mar 1, 2015 at 1:48 AM, Alexander Kuleshov
kuleshovm...@gmail.com wrote:
 '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 kuleshovm...@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.

 was_alias = run_argv(argc, argv);
 if (errno != ENOENT)
 break;
 --
 2.3.1.422.ge618558.dirty
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] git: make was_alias non-static

2015-02-28 Thread Alexander Kuleshov
'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 kuleshovm...@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;
-   static int was_alias = 0;
+   int was_alias = 0;
was_alias = run_argv(argc, argv);
if (errno != ENOENT)
break;
-- 
2.3.1.422.ge618558.dirty

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