openocd: remove NULL comparisons with checkpatch [1/2]

Patch generated automatically through the new checkpatch with
flags "--types COMPARISON_TO_NULL --fix-inplace".
This only fixes the comparisons
	if (symbol == NULL)
	if (symbol != NULL)
The case of NULL on the left side of the comparison is not tested.

Some automatic fix is incorrect and has been massaged by hands:
	-	if (*psig == NULL)
	+	if (*!psig)
changed as
	+	if (!*psig)

Change-Id: If4a1e2b4e547e223532e8e3d9da89bf9cb382ce6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6351
Tested-by: jenkins
This commit is contained in:
Antonio Borneo
2021-07-03 21:29:32 +02:00
parent 08ee7bb982
commit 3917823187
71 changed files with 181 additions and 181 deletions

View File

@@ -221,7 +221,7 @@ static char **script_command_args_alloc(
int len;
const char *w = Jim_GetString(argv[i], &len);
words[i] = strdup(w);
if (words[i] == NULL) {
if (!words[i]) {
script_command_args_free(words, i);
return NULL;
}
@@ -501,7 +501,7 @@ void command_print_sameline(struct command_invocation *cmd, const char *format,
va_start(ap, format);
string = alloc_vprintf(format, ap);
if (string != NULL && cmd) {
if (string && cmd) {
/* we want this collected in the log + we also want to pick it up as a tcl return
* value.
*
@@ -524,7 +524,7 @@ void command_print(struct command_invocation *cmd, const char *format, ...)
va_start(ap, format);
string = alloc_vprintf(format, ap);
if (string != NULL && cmd) {
if (string && cmd) {
strcat(string, "\n"); /* alloc_vprintf guaranteed the buffer to be at least one
*char longer */
/* we want this collected in the log + we also want to pick it up as a tcl return