Skip to content

Commit 3d39bcd

Browse files
dschogitster
authored andcommitted
Avoid redundant conditions
While `if (i <= 0) ... else if (i > 0) ...` is technically equivalent to `if (i <= 0) ... else ...`, the latter is vastly easier to read because it avoids writing out a condition that is unnecessary. Let's drop such unnecessary conditions. Pointed out by CodeQL. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6c91162 commit 3d39bcd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

help.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes)
214214
else if (cmp == 0) {
215215
ei++;
216216
free(cmds->names[ci++]);
217-
} else if (cmp > 0)
217+
} else
218218
ei++;
219219
}
220220

transport-helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@ static int udt_do_read(struct unidirectional_transfer *t)
14371437
transfer_debug("%s EOF (with %i bytes in buffer)",
14381438
t->src_name, (int)t->bufuse);
14391439
t->state = SSTATE_FLUSHING;
1440-
} else if (bytes > 0) {
1440+
} else {
14411441
t->bufuse += bytes;
14421442
transfer_debug("Read %i bytes from %s (buffer now at %i)",
14431443
(int)bytes, t->src_name, (int)t->bufuse);

0 commit comments

Comments
 (0)