git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 30/32] ident.c: fix LGTM warning on the possible abuse of the '=' operator
@ 2019-11-04  9:59 Elia Pinto
  2019-11-04  9:59 ` [PATCH 31/32] commit-graph.c: fix code that could convert the result of an integer multiplication to a larger type Elia Pinto
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Elia Pinto @ 2019-11-04  9:59 UTC (permalink / raw)
  To: git; +Cc: Elia Pinto

Fix the LGTM warning of the rule that finds uses of the assignment
operator = in places where the equality operator == would
make more sense.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
---
 ident.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/ident.c b/ident.c
index e666ee4e59..07f2f03b0a 100644
--- a/ident.c
+++ b/ident.c
@@ -172,12 +172,15 @@ const char *ident_default_email(void)
 			strbuf_addstr(&git_default_email, email);
 			committer_ident_explicitly_given |= IDENT_MAIL_GIVEN;
 			author_ident_explicitly_given |= IDENT_MAIL_GIVEN;
-		} else if ((email = query_user_email()) && email[0]) {
-			strbuf_addstr(&git_default_email, email);
-			free((char *)email);
-		} else
-			copy_email(xgetpwuid_self(&default_email_is_bogus),
+		} else {
+			email = query_user_email();
+			if (email && email[0]) {
+				strbuf_addstr(&git_default_email, email);
+				free((char *)email);
+			} else
+				copy_email(xgetpwuid_self(&default_email_is_bogus),
 				   &git_default_email, &default_email_is_bogus);
+		}
 		strbuf_trim(&git_default_email);
 	}
 	return git_default_email.buf;
-- 
2.24.0.rc0.467.g566ccdd3e4.dirty


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2019-11-07 12:49 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-04  9:59 [PATCH 30/32] ident.c: fix LGTM warning on the possible abuse of the '=' operator Elia Pinto
2019-11-04  9:59 ` [PATCH 31/32] commit-graph.c: fix code that could convert the result of an integer multiplication to a larger type Elia Pinto
2019-11-06  2:23   ` Junio C Hamano
2019-11-07  2:23     ` Danh Doan
2019-11-07  3:37       ` Junio C Hamano
2019-11-07  4:06         ` Danh Doan
2019-11-07 12:49           ` Johannes Schindelin
2019-11-07 12:45       ` Johannes Schindelin
2019-11-04  9:59 ` [PATCH 32/32] date.c: fix code that may overflow 'int' before it is converted to 'time_t' Elia Pinto
2019-11-04 10:26 ` [PATCH 30/32] ident.c: fix LGTM warning on the possible abuse of the '=' operator SZEDER Gábor
2019-11-04 13:55   ` Elia Pinto
2019-11-04 15:11     ` Phillip Wood
2019-11-04 19:55       ` Elia Pinto
2019-11-06  2:16 ` Junio C Hamano
2019-11-06 11:32   ` Johannes Schindelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).