aboutsummaryrefslogtreecommitdiffstats
path: root/sequencer.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-05-27 13:59:10 -0700
committerJunio C Hamano <gitster@pobox.com>2025-05-27 13:59:11 -0700
commitf9cdaa2860e20f3f36595646b7a82082aa772df8 (patch)
tree40513df8eb4aec40cc4ec28e0ba4855d532be476 /sequencer.c
parentMerge branch 'sj/use-mmap-to-check-packed-refs' (diff)
parentsequencer: stop pretending that an assignment is a condition (diff)
downloadgit-f9cdaa2860e20f3f36595646b7a82082aa772df8.tar.gz
git-f9cdaa2860e20f3f36595646b7a82082aa772df8.zip
Merge branch 'js/misc-fixes'
Assorted fixes for issues found with CodeQL. * js/misc-fixes: sequencer: stop pretending that an assignment is a condition bundle-uri: avoid using undefined output of `sscanf()` commit-graph: avoid using stale stack addresses trace2: avoid "futile conditional" Avoid redundant conditions fetch: avoid unnecessary work when there is no current branch has_dir_name(): make code more obvious upload-pack: rename `enum` to reflect the operation commit-graph: avoid malloc'ing a local variable fetch: carefully clear local variable's address after use commit: simplify code
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sequencer.c b/sequencer.c
index eacede6bf2..da855e27ca 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -2636,9 +2636,12 @@ static int is_command(enum todo_command command, const char **bol)
const char nick = todo_command_info[command].c;
const char *p = *bol;
- return (skip_prefix(p, str, &p) || (nick && *p++ == nick)) &&
- (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\r' || !*p) &&
- (*bol = p);
+ if ((skip_prefix(p, str, &p) || (nick && *p++ == nick)) &&
+ (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\r' || !*p)) {
+ *bol = p;
+ return 1;
+ }
+ return 0;
}
static int check_label_or_ref_arg(enum todo_command command, const char *arg)