zephyr/subsys/shell
Maksim Masalski a4c0810aa0 shell: changed dead code part in function buffer_trim()
According to the Coverity issue 190614 (github issue #12319)
Fix for logically dead code in function buffer_trim
Before while execution cannot reach this statement: buff[0] = '\0';

Tested and noticed that part of code is unnecessary inside of while
For the test, I made the same function in CodeBlocks and send to it
string to detect and delete whitespaces. After deletion of dead code
part, I tested function again, it works.

Function buffer_trim first detects whitespace characters in the end
of the string using first while, then it adds '\0' to the end
of the string to mark that string has new end after all whitespace
characters. Second while finds whitespaces at the beginning
of the string and counts how many whitespaces it found.
In the end using if counted whitespaces are removing from the
string.

Signed-off-by: Maksim Masalski <maxxliferobot@gmail.com>
2019-02-26 02:26:52 +01:00
..
modules
CMakeLists.txt
Kconfig
Kconfig.backends
Kconfig.template.shell_log_queue_size
Kconfig.template.shell_log_queue_timeout
shell_cmds.c
shell_dummy.c
shell_fprintf.c
shell_help.c
shell_help.h
shell_history.c
shell_log_backend.c
shell_ops.c
shell_ops.h
shell_rtt.c
shell_uart.c
shell_utils.c
shell_utils.h
shell_vt100.h
shell_wildcard.c
shell_wildcard.h
shell.c