sha1_name: compare variable with constant, not constant with variable
And restructure the if/else to factor out the common "is len positive?" test into a single conditional. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Felipe Contreras committed
Apr 30, 2013 at 16:49 UTC
1f27e7d56b65fdc232a5a2a4de2ee97ff5eb176b
1 file changed
+7
-5
sha1_name.c
+7
-5
@@ -1033,12 +1033,14 @@ int interpret_branch_name(const char *name, struct strbuf *buf)
1033
int len = interpret_nth_prior_checkout(name, buf);
1034
int tmp_len;
1035
1036
- if (!len)
1036
+ if (!len) {
1037
return len; /* syntax Ok, not enough switches */
1038
- if (0 < len && len == namelen)
1039
- return len; /* consumed all */
1040
- else if (0 < len)
1041
- return reinterpret(name, namelen, len, buf);
1038
+ } else if (len > 0) {
1039
+ if (len == namelen)
1040
+ return len; /* consumed all */
1041
+ else
1042
+ return reinterpret(name, namelen, len, buf);
1043
+ }
1044
1045
cp = strchr(name, '@');
1046
if (!cp)