Review recent changes in tc_util.c
Subsystems (2)
cover Review recent changes in tc_util.c
This silences a spurious compiler warning with gcc-7 and eliminates a needless conditional identified while investigating the warning.
Phil Sutter (2):
tc_util: Drop needless pointer check
tc_util: Silence spurious compiler warning
tc/tc_util.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Signature · 1 line
2.13.1
PATCH 2/2 tc_util: Silence spurious compiler warning
GCC version 7.2.1 complains that 'result1' may be used uninitialized in parse_action_control_slash_spaces(). This should not be possible in practice, so the actual value 'result1' is initialized with does not matter.
--- tc/tc_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tc/tc_util.c +1 -1
@@ -573,7 +573,7 @@ static int parse_action_control_slash_spaces(int *argc_p, char ***argv_p, {int argc = *argc_p;char **argv = *argv_p; -int result1, result2; +int result1 =-1 , result2;int *result_p = &result1;int ok =0 ;int ret;
Signature · 1 line
2.13.1
PATCH 1/2 tc_util: Drop needless pointer check
In reply to Phil SutterThe function parse_action_control_slash() returns early if 'p' is NULL, so after the first call to action_a2n(), 'p' is guaranteed not to be NULL. Otherwise, the assignment '*p = 0' above would dereference the NULL pointer already anyway, so just drop this check here.
--- tc/tc_util.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tc/tc_util.c +1 -2
@@ -631,8 +631,7 @@ int parse_action_control_slash(int *argc_p, char ***argv_p, allow_num); *p =0 ;if (action_a2n (*argv, &result1, allow_num)) { -if (p) - *p ='/' ; + *p ='/' ;return -1 ; }
Signature · 1 line
2.13.1