forked from auracaster/openocd
openocd: fix simple cases of NULL comparison
There are more than 1000 NULL comparisons to be aligned to the coding style. For recurrent NULL comparison it's preferable using trivial scripts in order to minimize the review effort. Patch generated automatically with the command: sed -i PATTERN $(find src/ -type f) where PATTERN is in the list: 's/(\([a-z][a-z0-9_]*\) == NULL)/(!\1)/g' 's/(\([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\) == NULL)/(!\1)/g' 's/(\([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\) == NULL)/(!\1)/g' 's/(\([a-z][a-z0-9_]*\) != NULL)/(\1)/g' 's/(\([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\) != NULL)/(\1)/g' 's/(\([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\) != NULL)/(\1)/g' 's/(NULL == \([a-z][a-z0-9_]*\))/(!\1)/g' 's/(NULL == \([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\))/(!\1)/g' 's/(NULL == \([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\))/(!\1)/g' 's/(NULL != \([a-z][a-z0-9_]*\))/(\1)/g' 's/(NULL != \([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\))/(\1)/g' 's/(NULL != \([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\))/(\1)/g' Change-Id: Ida103e325d6d0600fb69c0b7a1557ee969db4417 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6350 Tested-by: jenkins
This commit is contained in:
@@ -206,7 +206,7 @@ static const struct rtos_register_stacking *get_stacking_info(const struct rtos
|
||||
{
|
||||
const struct threadx_params *param = (const struct threadx_params *) rtos->rtos_specific_params;
|
||||
|
||||
if (param->fn_get_stacking_info != NULL)
|
||||
if (param->fn_get_stacking_info)
|
||||
return param->fn_get_stacking_info(rtos, stack_ptr);
|
||||
|
||||
return param->stacking_info + 0;
|
||||
@@ -216,12 +216,12 @@ static int is_thread_id_valid(const struct rtos *rtos, int64_t thread_id)
|
||||
{
|
||||
const struct threadx_params *param;
|
||||
|
||||
if (rtos->rtos_specific_params == NULL)
|
||||
if (!rtos->rtos_specific_params)
|
||||
return 0; /* invalid */
|
||||
|
||||
param = (const struct threadx_params *) rtos->rtos_specific_params;
|
||||
|
||||
if (param->fn_is_thread_id_valid != NULL)
|
||||
if (param->fn_is_thread_id_valid)
|
||||
return param->fn_is_thread_id_valid(rtos, thread_id);
|
||||
|
||||
return (thread_id != 0);
|
||||
@@ -263,15 +263,15 @@ static int threadx_update_threads(struct rtos *rtos)
|
||||
int thread_list_size = 0;
|
||||
const struct threadx_params *param;
|
||||
|
||||
if (rtos == NULL)
|
||||
if (!rtos)
|
||||
return -1;
|
||||
|
||||
if (rtos->rtos_specific_params == NULL)
|
||||
if (!rtos->rtos_specific_params)
|
||||
return -3;
|
||||
|
||||
param = (const struct threadx_params *) rtos->rtos_specific_params;
|
||||
|
||||
if (rtos->symbols == NULL) {
|
||||
if (!rtos->symbols) {
|
||||
LOG_ERROR("No symbols for ThreadX");
|
||||
return -4;
|
||||
}
|
||||
@@ -437,13 +437,13 @@ static int threadx_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
|
||||
int retval;
|
||||
const struct threadx_params *param;
|
||||
|
||||
if (rtos == NULL)
|
||||
if (!rtos)
|
||||
return -1;
|
||||
|
||||
if (!is_thread_id_valid(rtos, thread_id))
|
||||
return -2;
|
||||
|
||||
if (rtos->rtos_specific_params == NULL)
|
||||
if (!rtos->rtos_specific_params)
|
||||
return -3;
|
||||
|
||||
param = (const struct threadx_params *) rtos->rtos_specific_params;
|
||||
@@ -469,7 +469,7 @@ static int threadx_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
|
||||
const struct rtos_register_stacking *stacking_info =
|
||||
get_stacking_info(rtos, stack_ptr);
|
||||
|
||||
if (stacking_info == NULL) {
|
||||
if (!stacking_info) {
|
||||
LOG_ERROR("Unknown stacking info for thread id=0x%" PRIx64, (uint64_t)thread_id);
|
||||
return -6;
|
||||
}
|
||||
@@ -518,18 +518,18 @@ static int threadx_get_thread_detail(struct rtos *rtos,
|
||||
|
||||
const struct threadx_params *param;
|
||||
|
||||
if (rtos == NULL)
|
||||
if (!rtos)
|
||||
return -1;
|
||||
|
||||
if (thread_id == 0)
|
||||
return -2;
|
||||
|
||||
if (rtos->rtos_specific_params == NULL)
|
||||
if (!rtos->rtos_specific_params)
|
||||
return -3;
|
||||
|
||||
param = (const struct threadx_params *) rtos->rtos_specific_params;
|
||||
|
||||
if (rtos->symbols == NULL) {
|
||||
if (!rtos->symbols) {
|
||||
LOG_ERROR("No symbols for ThreadX");
|
||||
return -3;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user