From 2959caf18cabfa4eb62aa6baae1f3a2a5b60d5a8 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Sat, 21 Aug 2010 13:52:25 +0000 Subject: [PATCH] Convert (hopefully) all comparisons to NULL Apply badzero.cocci, badnull.coci and badnull2.cocci This should convert all cases where there's a comparison to NULL to simpler forms. This patch applies the following transformations: code before patch ||code after patch =============================================================== return a == NULL; return !a; return a != NULL; return !!a; func(a == NULL); func(!a); func(a != NULL); func(!!a); b = a == NULL; b = !a; b = a != NULL; b = !!a; b = a == NULL ? c : d; b = !a ? c : d; b = a != NULL ? c : d; b = a ? c : d; other cases: a == NULL !a a != NULL a SVN revision: 51487 --- src/file.c | 2 +- src/icon_chooser.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/file.c b/src/file.c index 49c115b..b228387 100644 --- a/src/file.c +++ b/src/file.c @@ -54,7 +54,7 @@ char *homedir (int uid) return (s); } return (g_strdup - ((getenv ("TMPDIR") == NULL) ? "/tmp" : getenv ("TMPDIR"))); + ((!getenv("TMPDIR")) ? "/tmp" : getenv ("TMPDIR"))); } void compile_regex () diff --git a/src/icon_chooser.c b/src/icon_chooser.c index 3297d20..7e50cf2 100644 --- a/src/icon_chooser.c +++ b/src/icon_chooser.c @@ -325,7 +325,7 @@ void update_preview_cb (GtkFileChooser *file_chooser, gpointer data) height = 1; pixbuf = gdk_pixbuf_new_from_file_at_size (filename, width, height, NULL); - have_preview = (pixbuf != NULL); + have_preview = (pixbuf); g_free (filename); gtk_image_set_from_pixbuf (GTK_IMAGE (preview), pixbuf);