Gedare Bloom started a new discussion on cpukit/libmisc/shell/shell.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/495#note_123325 > + * Find the boundaries of the current word in a command line > + */ > +static void rtems_shell_find_word_bounds(char *line, int col, char > **word_start, int *word_len) { > + *word_start = line + col; > + while (*word_start > line && !isspace((unsigned char)*(*word_start - 1))) > { > + (*word_start)--; > + } > + *word_len = (line + col) - *word_start; > +} > + > +/* Calculate the common prefix length between two strings */ > +static int rtems_shell_calculate_common_prefix(const char *str1, const char > *str2, int start_pos, int current_common_len) { > + int i; > + int max_len = current_common_len; > + > + for (i = start_pos; i < current_common_len && i < strlen(str2); i++) { should not call `strlen` in a loop. calculate it before the loop. -- View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/495#note_123325 You're receiving this email because of your account on gitlab.rtems.org.
_______________________________________________ bugs mailing list bugs@rtems.org http://lists.rtems.org/mailman/listinfo/bugs