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:
Antonio Borneo
2021-07-03 18:51:20 +02:00
parent b159f5cded
commit 08ee7bb982
166 changed files with 856 additions and 856 deletions

View File

@@ -539,7 +539,7 @@ static int esirisc_add_breakpoints(struct target *target)
LOG_DEBUG("-");
while (breakpoint != NULL) {
while (breakpoint) {
if (breakpoint->set == 0)
esirisc_add_breakpoint(target, breakpoint);
@@ -723,7 +723,7 @@ static int esirisc_add_watchpoints(struct target *target)
LOG_DEBUG("-");
while (watchpoint != NULL) {
while (watchpoint) {
if (watchpoint->set == 0)
esirisc_add_watchpoint(target, watchpoint);
@@ -890,7 +890,7 @@ static int esirisc_resume_or_step(struct target *target, int current, target_add
if (handle_breakpoints) {
breakpoint = breakpoint_find(target, address);
if (breakpoint != NULL)
if (breakpoint)
esirisc_remove_breakpoint(target, breakpoint);
}
@@ -1061,7 +1061,7 @@ static int esirisc_debug_entry(struct target *target)
case EID_INST_BREAKPOINT:
breakpoint = breakpoint_find(target,
buf_get_u32(esirisc->epc->value, 0, esirisc->epc->size));
target->debug_reason = (breakpoint != NULL) ?
target->debug_reason = (breakpoint) ?
DBG_REASON_BREAKPOINT : DBG_REASON_DBGRQ;
break;
@@ -1561,7 +1561,7 @@ static int esirisc_target_create(struct target *target, Jim_Interp *interp)
struct jtag_tap *tap = target->tap;
struct esirisc_common *esirisc;
if (tap == NULL)
if (!tap)
return ERROR_FAIL;
if (tap->ir_length != INSTR_LENGTH) {
@@ -1571,7 +1571,7 @@ static int esirisc_target_create(struct target *target, Jim_Interp *interp)
}
esirisc = calloc(1, sizeof(struct esirisc_common));
if (esirisc == NULL)
if (!esirisc)
return ERROR_FAIL;
esirisc->target = target;