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:
@@ -187,7 +187,7 @@ static int dap_configure(struct jim_getopt_info *goi, struct arm_dap_object *dap
|
||||
if (e != JIM_OK)
|
||||
return e;
|
||||
tap = jtag_tap_by_jim_obj(goi->interp, o_t);
|
||||
if (tap == NULL) {
|
||||
if (!tap) {
|
||||
Jim_SetResultString(goi->interp, "-chain-position is invalid", -1);
|
||||
return JIM_ERR;
|
||||
}
|
||||
@@ -202,7 +202,7 @@ static int dap_configure(struct jim_getopt_info *goi, struct arm_dap_object *dap
|
||||
}
|
||||
}
|
||||
|
||||
if (tap == NULL) {
|
||||
if (!tap) {
|
||||
Jim_SetResultString(goi->interp, "-chain-position required when creating DAP", -1);
|
||||
return JIM_ERR;
|
||||
}
|
||||
@@ -223,7 +223,7 @@ static int dap_create(struct jim_getopt_info *goi)
|
||||
int e;
|
||||
|
||||
cmd_ctx = current_command_context(goi->interp);
|
||||
assert(cmd_ctx != NULL);
|
||||
assert(cmd_ctx);
|
||||
|
||||
if (goi->argc < 3) {
|
||||
Jim_WrongNumArgs(goi->interp, 1, goi->argv, "?name? ..options...");
|
||||
@@ -241,7 +241,7 @@ static int dap_create(struct jim_getopt_info *goi)
|
||||
|
||||
/* Create it */
|
||||
dap = calloc(1, sizeof(struct arm_dap_object));
|
||||
if (dap == NULL)
|
||||
if (!dap)
|
||||
return JIM_ERR;
|
||||
|
||||
e = dap_configure(goi, dap);
|
||||
@@ -317,7 +317,7 @@ COMMAND_HANDLER(handle_dap_info_command)
|
||||
struct adiv5_dap *dap = arm->dap;
|
||||
uint32_t apsel;
|
||||
|
||||
if (dap == NULL) {
|
||||
if (!dap) {
|
||||
LOG_ERROR("DAP instance not available. Probably a HLA target...");
|
||||
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user