hv:change shell_puts to void type

Change this function to void type
Remove some parameters check, add these checks as preconditions

Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
This commit is contained in:
Mingqiang Chi 2018-07-11 12:57:29 +08:00 committed by Jack Ren
parent 4cab8b9cc5
commit 2d03706dd5
2 changed files with 9 additions and 16 deletions

View File

@ -170,7 +170,7 @@ uint8_t shell_getc_serial(struct shell *p_shell);
void shell_special_serial(struct shell *p_shell, uint8_t ch);
void kick_shell(struct shell *p_shell);
int shell_puts(struct shell *p_shell, const char *str_ptr);
void shell_puts(struct shell *p_shell, const char *str_ptr);
int shell_set_name(struct shell *p_shell, const char *name);
int shell_trigger_crash(struct shell *p_shell, int argc, char **argv);

View File

@ -159,23 +159,16 @@ int shell_init(void)
return status;
}
int shell_puts(struct shell *p_shell, const char *str_ptr)
/**
* @pre p_shell != NULL
* @pre p_shell->session_io.io_puts != NULL
* @pre str_ptr != NULL
*/
void shell_puts(struct shell *p_shell, const char *str_ptr)
{
int status;
/* Transmit data using this shell session's 'puts' function */
p_shell->session_io.io_puts(p_shell, str_ptr);
if ((p_shell != NULL) && (p_shell->session_io.io_puts != NULL) &&
(str_ptr != NULL)) {
/* Transmit data using this shell session's 'puts' function */
p_shell->session_io.io_puts(p_shell, str_ptr);
status = 0;
} else {
/* Error: Invalid request */
status = -EINVAL;
}
return status;
}
int shell_set_name(struct shell *p_shell, const char *name)