shell: Make shell_strlen return u16_t

Everywhere the return of this function was being assigned to u16_t to
save space on stack. Instead of casting in all these places (and may
end up with overflow), just changing this function's return.

Note that the function itself is not checking for overflow yet since
I'm not sure this can happen and/or is a problem. Though now we have
only one single point to fix this problem.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2018-12-03 13:04:38 -08:00 committed by Anas Nashif
commit 80c03550ba
4 changed files with 13 additions and 12 deletions

View file

@ -31,9 +31,9 @@ s32_t column_span_with_buffer_offsets_get(struct shell_multiline_cons *cons,
void shell_multiline_data_calc(struct shell_multiline_cons *cons,
u16_t buff_pos, u16_t buff_len);
static inline size_t shell_strlen(const char *str)
static inline u16_t shell_strlen(const char *str)
{
return str == NULL ? 0 : strlen(str);
return str == NULL ? 0U : (u16_t)strlen(str);
}
char shell_make_argv(size_t *argc, char **argv, char *cmd, uint8_t max_argc);