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:
@@ -143,7 +143,7 @@ int arm_cti_read_reg(struct arm_cti *self, unsigned int reg, uint32_t *p_value)
|
||||
{
|
||||
struct adiv5_ap *ap = dap_ap(self->spot.dap, self->spot.ap_num);
|
||||
|
||||
if (p_value == NULL)
|
||||
if (!p_value)
|
||||
return ERROR_COMMAND_ARGUMENT_INVALID;
|
||||
|
||||
return mem_ap_read_atomic_u32(ap, self->spot.base + reg, p_value);
|
||||
@@ -456,7 +456,7 @@ static int cti_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...");
|
||||
@@ -474,7 +474,7 @@ static int cti_create(struct jim_getopt_info *goi)
|
||||
|
||||
/* Create it */
|
||||
cti = calloc(1, sizeof(*cti));
|
||||
if (cti == NULL)
|
||||
if (!cti)
|
||||
return JIM_ERR;
|
||||
|
||||
adiv5_mem_ap_spot_init(&cti->spot);
|
||||
|
||||
Reference in New Issue
Block a user