From 08ee7bb982b16742f52cfdc6c649d82ffa2eb177 Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Sat, 3 Jul 2021 18:51:20 +0200 Subject: 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 Reviewed-on: http://openocd.zylin.com/6350 Tested-by: jenkins --- src/jtag/drivers/vsllink.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/jtag/drivers/vsllink.c') diff --git a/src/jtag/drivers/vsllink.c b/src/jtag/drivers/vsllink.c index 6a592bc..b4597b7 100644 --- a/src/jtag/drivers/vsllink.c +++ b/src/jtag/drivers/vsllink.c @@ -105,7 +105,7 @@ static int vsllink_execute_queue(void) " vsllink " "-------------------------------------"); - while (cmd != NULL) { + while (cmd) { switch (cmd->type) { case JTAG_RUNTEST: LOG_DEBUG_IO("runtest %i cycles, end in %s", @@ -280,7 +280,7 @@ static int vsllink_quit(void) static int vsllink_interface_init(void) { vsllink_handle = malloc(sizeof(struct vsllink)); - if (NULL == vsllink_handle) { + if (!vsllink_handle) { LOG_ERROR("unable to allocate memory"); return ERROR_FAIL; } @@ -333,7 +333,7 @@ static int vsllink_init(void) tdi_buffer = malloc(tap_buffer_size); tdo_buffer = malloc(tap_buffer_size); tms_buffer = malloc(tap_buffer_size); - if ((NULL == tdi_buffer) || (NULL == tdo_buffer) || (NULL == tms_buffer)) { + if ((!tdi_buffer) || (!tdo_buffer) || (!tms_buffer)) { vsllink_quit(); return ERROR_FAIL; } -- cgit v1.1