Skip to content
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

Refactor count_names() for improved clarity #2788

Merged
merged 1 commit into from
Dec 15, 2023
Merged
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
16 changes: 6 additions & 10 deletions src/emc/motion/motion.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,12 @@ static void emc_message_handler(msg_level_t level, const char *fmt, va_list ap)
va_end(apc);
}

int count_names(char *names[]){
int namecount = 0;
int i;
for (i = 0; i < MAX_IO; i++) {
if (((names[i] == NULL) || (*names[i] == 0))){
break;
}
namecount = i + 1;
}
return namecount;
int count_names(char *names[])
{
int count = 0;
while (count < MAX_IO && names[count] && *names[count])
count++;
return count;
}

static int module_intfc() {
Expand Down
Loading