Skip to content

initialize call to ARRAY_SIZE macro outside the control part of loop #542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions git.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,8 @@ static struct cmd_struct commands[] = {
static struct cmd_struct *get_builtin(const char *s)
{
int i;
for (i = 0; i < ARRAY_SIZE(commands); i++) {
int get_array_size = ARRAY_SIZE(commands);
for (i = 0; i < get_array_size; i++) {
struct cmd_struct *p = commands + i;
if (!strcmp(s, p->cmd))
return p;
Expand All @@ -623,7 +624,8 @@ int is_builtin(const char *s)
static void list_builtins(struct string_list *out, unsigned int exclude_option)
{
int i;
for (i = 0; i < ARRAY_SIZE(commands); i++) {
int get_array_size = ARRAY_SIZE(commands);
for (i = 0; i < get_array_size; i++) {
if (exclude_option &&
(commands[i].option & exclude_option))
continue;
Expand Down