From: lucas Date: Sat, 21 Aug 2010 13:52:25 +0000 (+0000) Subject: Convert (hopefully) all comparisons to NULL X-Git-Tag: build/2012-07-04.173327~1854 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1f80ed758118705c741ddffab44dcee75d4db2ab;p=profile%2Fivi%2Fecore.git 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 git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@51487 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/bin/ecore_config.c b/src/bin/ecore_config.c index 8bf2988..b4973d9 100644 --- a/src/bin/ecore_config.c +++ b/src/bin/ecore_config.c @@ -36,8 +36,8 @@ pathcmp(const char *s1, const char *s2) // order folders before files s1d = strchr(s1, '/'); s2d = strchr(s2, '/'); - if (s1d != NULL && s2d == NULL) return -1; - if (s1d == NULL && s2d != NULL) return 1; + if (s1d && !s2d) return -1; + if (!s1d && s2d) return 1; return strcmp(s1, s2); } @@ -47,7 +47,7 @@ del(const char *key) { Ecore_Config_Prop *e; e = ecore_config_get(key); - if(e == NULL) return -1; + if(!e) return -1; ecore_config_dst(e); return 0; @@ -258,7 +258,7 @@ main(int argc, char * const argv[]) if(cmd == 's' && type == -1) usage_and_exit(prog, 2, "You need to specify a command!"); - if(cmd != 'a' && key == NULL) + if(cmd != 'a' && !key) usage_and_exit(prog, 2, "You need to specify key!"); if(ecore_config_init("econfig") != ECORE_CONFIG_ERR_SUCC) diff --git a/src/lib/ecore/ecore_exe.c b/src/lib/ecore/ecore_exe.c index 43b6cf1..e8eec95 100644 --- a/src/lib/ecore/ecore_exe.c +++ b/src/lib/ecore/ecore_exe.c @@ -430,7 +430,7 @@ ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data) if (!exe_cmd) return NULL; exe = calloc(1, sizeof(Ecore_Exe)); - if (exe == NULL) return NULL; + if (!exe) return NULL; if ((flags & ECORE_EXE_PIPE_AUTO) && (!(flags & ECORE_EXE_PIPE_ERROR)) && (!(flags & ECORE_EXE_PIPE_READ))) @@ -614,7 +614,7 @@ ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data) ECORE_FD_READ, _ecore_exe_data_error_handler, exe, NULL, NULL); - if (exe->error_fd_handler == NULL) + if (!exe->error_fd_handler) ok = 0; } } @@ -635,7 +635,7 @@ ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data) ECORE_FD_READ, _ecore_exe_data_read_handler, exe, NULL, NULL); - if (exe->read_fd_handler == NULL) + if (!exe->read_fd_handler) ok = 0; } } @@ -758,7 +758,7 @@ ecore_exe_send(Ecore_Exe * exe, const void *data, int size) } buf = realloc(exe->write_data_buf, exe->write_data_size + size); - if (buf == NULL) return EINA_FALSE; + if (!buf) return EINA_FALSE; exe->write_data_buf = buf; memcpy((char *)exe->write_data_buf + exe->write_data_size, data, size); @@ -1388,7 +1388,7 @@ _ecore_exe_make_sure_its_dead(void *data) { Ecore_Exe *exe = NULL; - if ((exe = _ecore_exe_is_it_alive(dead->pid)) != NULL) + if ((exe = _ecore_exe_is_it_alive(dead->pid))) { if (dead->cmd) INF("Sending KILL signal to alledgedly dead %s (%d).", @@ -1420,7 +1420,7 @@ _ecore_exe_make_sure_its_really_dead(void *data) { Ecore_Exe *exe = NULL; - if ((exe = _ecore_exe_is_it_alive(dead->pid)) != NULL) + if ((exe = _ecore_exe_is_it_alive(dead->pid))) { ERR("RUN! The zombie wants to eat your brains! And your CPU!"); if (dead->cmd) @@ -1549,10 +1549,10 @@ _ecore_exe_exec_it(const char *exe_cmd, Ecore_Exe_Flags flags) } else if (use_sh) { /* We have to use a shell to run this. */ - if (shell == NULL) + if (!shell) { /* Find users preferred shell. */ shell = getenv("SHELL"); - if (shell == NULL) + if (!shell) shell = "/bin/sh"; } errno = 0; diff --git a/src/lib/ecore/ecore_exe_win32.c b/src/lib/ecore/ecore_exe_win32.c index 17448ad..30d7d3c 100644 --- a/src/lib/ecore/ecore_exe_win32.c +++ b/src/lib/ecore/ecore_exe_win32.c @@ -325,7 +325,7 @@ ecore_exe_send(Ecore_Exe *exe, const void *data, int size) } buf = realloc(exe->pipe_write.data_buf, exe->pipe_write.data_size + size); - if (buf == NULL) return 0; + if (!buf) return 0; exe->pipe_write.data_buf = buf; memcpy((char *)exe->pipe_write.data_buf + exe->pipe_write.data_size, data, size); diff --git a/src/lib/ecore/ecore_getopt.c b/src/lib/ecore/ecore_getopt.c index 1c1de8b..f00c46e 100644 --- a/src/lib/ecore/ecore_getopt.c +++ b/src/lib/ecore/ecore_getopt.c @@ -500,11 +500,11 @@ _ecore_getopt_help_desc_choices(FILE *fp, const int base, const int total, int u used = _ecore_getopt_help_line (fp, base, total, used, _("Choices: "), strlen(_("Choices: "))); - for (itr = desc->action_param.choices; *itr != NULL; itr++) + for (itr = desc->action_param.choices; *itr; itr++) { used = _ecore_getopt_help_line (fp, base, total, used, *itr, strlen(*itr)); - if (itr[1] != NULL) + if (itr[1]) used = _ecore_getopt_help_line(fp, base, total, used, sep, seplen); } @@ -587,7 +587,7 @@ _ecore_getopt_help_desc(FILE *fp, const Ecore_Getopt_Desc *desc) static unsigned char _ecore_getopt_desc_is_sentinel(const Ecore_Getopt_Desc *desc) { - return (desc->shortname == '\0') && (desc->longname == NULL); + return (desc->shortname == '\0') && (!desc->longname); } static void @@ -618,7 +618,7 @@ ecore_getopt_help(FILE *fp, const Ecore_Getopt *parser) if (argc < 1) { ecore_app_args_get(&argc, &argv); - if ((argc > 0) && (argv[0] != NULL)) + if ((argc > 0) && (argv[0])) prog = argv[0]; else prog = parser->prog; @@ -1010,7 +1010,7 @@ _ecore_getopt_parse_choice(const Ecore_Getopt *parser __UNUSED__, const Ecore_Ge } pchoice = desc->action_param.choices; - for (; *pchoice != NULL; pchoice++) + for (; *pchoice; pchoice++) if (strcmp(*pchoice, arg_val) == 0) { *val->strp = (char *)*pchoice; @@ -1021,10 +1021,10 @@ _ecore_getopt_parse_choice(const Ecore_Getopt *parser __UNUSED__, const Ecore_Ge (desc, _("invalid choice \"%s\". Valid values are: "), arg_val); pchoice = desc->action_param.choices; - for (; *pchoice != NULL; pchoice++) + for (; *pchoice; pchoice++) { fputs(*pchoice, stderr); - if (pchoice[1] != NULL) + if (pchoice[1]) fputs(", ", stderr); } @@ -1626,7 +1626,7 @@ ecore_getopt_parse(const Ecore_Getopt *parser, Ecore_Getopt_Value *values, int a return -1; } - if ((argc < 1) || (argv == NULL)) + if ((argc < 1) || (!argv)) ecore_app_args_get(&argc, &argv); if (argc < 1) @@ -1635,7 +1635,7 @@ ecore_getopt_parse(const Ecore_Getopt *parser, Ecore_Getopt_Value *values, int a return -1; } - if (argv[0] != NULL) + if (argv[0]) prog = argv[0]; else prog = parser->prog; diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c index 7530114..10a4fd3 100644 --- a/src/lib/ecore/ecore_main.c +++ b/src/lib/ecore/ecore_main.c @@ -1315,7 +1315,7 @@ _ecore_main_win32_select(int nfds __UNUSED__, fd_set *readfds, fd_set *writefds, /* Wait for any message sent or posted to this queue */ /* or for one of the passed handles be set to signaled. */ - if (tv == NULL) + if (!tv) timeout = INFINITE; else timeout = (DWORD)((tv->tv_sec * 1000.0) + (tv->tv_usec / 1000.0)); diff --git a/src/lib/ecore/ecore_pipe.c b/src/lib/ecore/ecore_pipe.c index 87f9038..9c26133 100644 --- a/src/lib/ecore/ecore_pipe.c +++ b/src/lib/ecore/ecore_pipe.c @@ -326,7 +326,7 @@ ecore_pipe_del(Ecore_Pipe *p) ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_del"); return NULL; } - if (p->fd_handler != NULL) ecore_main_fd_handler_del(p->fd_handler); + if (p->fd_handler) ecore_main_fd_handler_del(p->fd_handler); if (p->fd_read != PIPE_FD_INVALID) pipe_close(p->fd_read); if (p->fd_write != PIPE_FD_INVALID) pipe_close(p->fd_write); data = (void *)p->data; diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c index 97b6743..e25c712 100644 --- a/src/lib/ecore_con/ecore_con.c +++ b/src/lib/ecore_con/ecore_con.c @@ -1664,7 +1664,7 @@ _ecore_con_cl_udp_handler(void *data, Ecore_Fd_Handler *fd_handler) unsigned char *inbuf; inbuf = malloc(num); - if(inbuf == NULL) + if(!inbuf) return 1; memcpy(inbuf, buf, num); @@ -1739,7 +1739,7 @@ _ecore_con_svr_udp_handler(void *data, Ecore_Fd_Handler *fd_handler) /* Create a new client for use in the client data event */ cl = calloc(1, sizeof(Ecore_Con_Client)); - if(cl == NULL) + if(!cl) return ECORE_CALLBACK_RENEW; cl->buf = NULL; @@ -1748,7 +1748,7 @@ _ecore_con_svr_udp_handler(void *data, Ecore_Fd_Handler *fd_handler) cl->server = svr; cl->client_addr = calloc(1, client_addr_len); cl->client_addr_len = client_addr_len; - if(cl->client_addr == NULL) + if(!cl->client_addr) { free(cl); return ECORE_CALLBACK_RENEW; @@ -1762,7 +1762,7 @@ _ecore_con_svr_udp_handler(void *data, Ecore_Fd_Handler *fd_handler) cl->client_addr_len); inbuf = malloc(num); - if(inbuf == NULL) + if(!inbuf) { free(cl->client_addr); free(cl); diff --git a/src/lib/ecore_con/ecore_con_ares.c b/src/lib/ecore_con/ecore_con_ares.c index 243c16f..b676067 100644 --- a/src/lib/ecore_con/ecore_con_ares.c +++ b/src/lib/ecore_con/ecore_con_ares.c @@ -427,7 +427,7 @@ _ecore_con_info_ares_host_cb(Ecore_Con_CAres *arg, int status, int timeouts, switch (status) { case ARES_SUCCESS: - if (hostent->h_addr_list[0] == NULL) + if (!hostent->h_addr_list[0]) { fprintf(stderr, "No IP found\n"); goto on_error; diff --git a/src/lib/ecore_con/ecore_con_url.c b/src/lib/ecore_con/ecore_con_url.c index 27b1b61..09a0e8c 100644 --- a/src/lib/ecore_con/ecore_con_url.c +++ b/src/lib/ecore_con/ecore_con_url.c @@ -736,7 +736,7 @@ ecore_con_url_httpauth_set(Ecore_Con_Url *url_con, const char *username, } # if LIBCURL_VERSION_NUM >= 0x071301 - if ((username != NULL) && (password != NULL)) + if ((username) && (password)) { if (safe) curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPAUTH, @@ -1073,7 +1073,7 @@ _ecore_con_url_restart_fd_handler(void) EINA_LIST_FOREACH(_url_con_list, l, url_con) { - if (url_con->fd_handler == NULL && url_con->fd != -1) + if (!url_con->fd_handler && url_con->fd != -1) { url_con->fd_handler = ecore_main_fd_handler_add(url_con->fd, url_con->flags, @@ -1345,7 +1345,7 @@ _ecore_con_url_fd_handler(void *data __UNUSED__, { _ecore_con_url_suspend_fd_handler(); - if (_fd_idler_handler == NULL) + if (!_fd_idler_handler) _fd_idler_handler = ecore_idler_add( _ecore_con_url_idler_handler, NULL); @@ -1363,7 +1363,7 @@ _ecore_con_url_process_completed_jobs(Ecore_Con_Url *url_con_to_match) int job_matched = 0; /* Loop jobs and check if any are done */ - while ((curlmsg = curl_multi_info_read(curlm, &n_remaining)) != NULL) + while ((curlmsg = curl_multi_info_read(curlm, &n_remaining))) { if (curlmsg->msg != CURLMSG_DONE) continue; diff --git a/src/lib/ecore_config/ecore_config_extra.c b/src/lib/ecore_config/ecore_config_extra.c index 6a92dd8..6d47c81 100644 --- a/src/lib/ecore_config/ecore_config_extra.c +++ b/src/lib/ecore_config/ecore_config_extra.c @@ -423,7 +423,7 @@ ecore_config_theme_search_path_append(const char *path) len = strlen(path); search_len = strlen(search_path); - if (loc == NULL || (loc != search_path && *(loc - 1) != '|') || + if (!loc || (loc != search_path && *(loc - 1) != '|') || (loc != (search_path + search_len - len) && *(loc + len - 1) != '|')) { new_search_path = malloc(search_len + len + 2); /* 2 = \0 + | */ diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index ab4d87b..ca1fdf2 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -731,7 +731,7 @@ ecore_evas_engines_get(void) const struct ecore_evas_engine *itr; Eina_List *lst = NULL; - for (itr = _engines; itr->name != NULL; itr++) + for (itr = _engines; itr->name; itr++) lst = eina_list_append(lst, itr->name); return lst; @@ -753,7 +753,7 @@ _ecore_evas_new_auto_discover(int x, int y, int w, int h, const char *extra_opti DBG("auto discover engine"); - for (itr = _engines; itr->constructor != NULL; itr++) + for (itr = _engines; itr->constructor; itr++) { Ecore_Evas *ee = itr->constructor(x, y, w, h, extra_options); if (ee) @@ -801,7 +801,7 @@ ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char * if (!engine_name) return _ecore_evas_new_auto_discover(x, y, w, h, extra_options); - for (itr = _engines; itr->name != NULL; itr++) + for (itr = _engines; itr->name; itr++) if (strcmp(itr->name, engine_name) == 0) { INF("using engine '%s', extra_options=%s", diff --git a/src/lib/ecore_evas/ecore_evas_cocoa.c b/src/lib/ecore_evas/ecore_evas_cocoa.c index 7ebdb4c..bdc7cd4 100644 --- a/src/lib/ecore_evas/ecore_evas_cocoa.c +++ b/src/lib/ecore_evas/ecore_evas_cocoa.c @@ -263,7 +263,7 @@ _ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int h if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); - if (obj == NULL) + if (!obj) { ee->prop.cursor.object = NULL; ee->prop.cursor.layer = 0; diff --git a/src/lib/ecore_evas/ecore_evas_directfb.c b/src/lib/ecore_evas/ecore_evas_directfb.c index 0b2a174..b3cf77c 100644 --- a/src/lib/ecore_evas/ecore_evas_directfb.c +++ b/src/lib/ecore_evas/ecore_evas_directfb.c @@ -352,7 +352,7 @@ _ecore_evas_directfb_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int lay if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); - if (obj == NULL) + if (!obj) { ee->prop.cursor.object = NULL; ee->prop.cursor.layer = 0; diff --git a/src/lib/ecore_evas/ecore_evas_fb.c b/src/lib/ecore_evas/ecore_evas_fb.c index 7403c12..3f974d5 100644 --- a/src/lib/ecore_evas/ecore_evas_fb.c +++ b/src/lib/ecore_evas/ecore_evas_fb.c @@ -418,7 +418,7 @@ _ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int h if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); - if (obj == NULL) + if (!obj) { ee->prop.cursor.object = NULL; ee->prop.cursor.layer = 0; diff --git a/src/lib/ecore_evas/ecore_evas_sdl.c b/src/lib/ecore_evas/ecore_evas_sdl.c index e555011..6a55927 100644 --- a/src/lib/ecore_evas/ecore_evas_sdl.c +++ b/src/lib/ecore_evas/ecore_evas_sdl.c @@ -259,7 +259,7 @@ _ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int h if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); - if (obj == NULL) + if (!obj) { ee->prop.cursor.object = NULL; ee->prop.cursor.layer = 0; diff --git a/src/lib/ecore_evas/ecore_evas_win32.c b/src/lib/ecore_evas/ecore_evas_win32.c index 7c1f236..e1d283b 100644 --- a/src/lib/ecore_evas/ecore_evas_win32.c +++ b/src/lib/ecore_evas/ecore_evas_win32.c @@ -773,7 +773,7 @@ _ecore_evas_win32_fullscreen_set(Ecore_Evas *ee, int on) Evas_Engine_Info_Software_DDraw *einfo; einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(ecore_evas_get(ee)); - if (einfo != NULL) + if (einfo) { einfo->info.fullscreen = !!on; /* einfo->info.layered = window->shape.layered; */ @@ -788,7 +788,7 @@ _ecore_evas_win32_fullscreen_set(Ecore_Evas *ee, int on) Evas_Engine_Info_Direct3D *einfo; einfo = (Evas_Engine_Info_Direct3D *)evas_engine_info_get(ecore_evas_get(ee)); - if (einfo != NULL) + if (einfo) { einfo->info.fullscreen = !!on; einfo->info.layered = window->shape.layered; diff --git a/src/lib/ecore_evas/ecore_evas_wince.c b/src/lib/ecore_evas/ecore_evas_wince.c index f1cbdca..1c3cbb4 100644 --- a/src/lib/ecore_evas/ecore_evas_wince.c +++ b/src/lib/ecore_evas/ecore_evas_wince.c @@ -661,7 +661,7 @@ _ecore_evas_wince_fullscreen_set(Ecore_Evas *ee, int on) } einfo = (Evas_Engine_Info_Software_16_WinCE *)evas_engine_info_get(ecore_evas_get(ee)); - if (einfo != NULL) + if (einfo) { einfo->info.fullscreen = !!on; /* einfo->info.layered = window->shape.layered; */ diff --git a/src/lib/ecore_evas/ecore_evas_x.c b/src/lib/ecore_evas/ecore_evas_x.c index 09a636f..e863b64 100644 --- a/src/lib/ecore_evas/ecore_evas_x.c +++ b/src/lib/ecore_evas/ecore_evas_x.c @@ -2378,7 +2378,7 @@ _ecore_evas_x_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); - if (obj == NULL) + if (!obj) { ee->prop.cursor.object = NULL; ee->prop.cursor.layer = 0; diff --git a/src/lib/ecore_fb/ecore_fb_ts.c b/src/lib/ecore_fb/ecore_fb_ts.c index c106ecc..c1e1f08 100644 --- a/src/lib/ecore_fb/ecore_fb_ts.c +++ b/src/lib/ecore_fb/ecore_fb_ts.c @@ -80,7 +80,7 @@ ecore_fb_ts_init(void) { #ifdef HAVE_TSLIB char *tslib_tsdevice = NULL; - if ( ( tslib_tsdevice = getenv("TSLIB_TSDEVICE") ) != NULL ) + if ( (tslib_tsdevice = getenv("TSLIB_TSDEVICE")) ) { printf( "ECORE_FB: TSLIB_TSDEVICE = '%s'\n", tslib_tsdevice ); _ecore_fb_tslib_tsdev = ts_open( tslib_tsdevice, 1 ); /* 1 = nonblocking, 0 = blocking */ diff --git a/src/lib/ecore_file/ecore_file.c b/src/lib/ecore_file/ecore_file.c index 3229896..ec0a1f7 100644 --- a/src/lib/ecore_file/ecore_file.c +++ b/src/lib/ecore_file/ecore_file.c @@ -177,7 +177,7 @@ ecore_file_mkdirs(const char **dirs) if (!dirs) return -1; - for (; *dirs != NULL; dirs++) + for (; *dirs; dirs++) if (ecore_file_mkdir(*dirs)) i++; return i; @@ -234,7 +234,7 @@ ecore_file_mksubdirs(const char *base, const char **subdirs) #endif i = 0; - for (; *subdirs != NULL; subdirs++) + for (; *subdirs; subdirs++) { struct stat st; @@ -420,7 +420,7 @@ ecore_file_mkpaths(const char **paths) if (!paths) return -1; - for (; *paths != NULL; paths++) + for (; *paths; paths++) if (ecore_file_mkpath(*paths)) i++; return i; diff --git a/src/lib/ecore_file/ecore_file_download.c b/src/lib/ecore_file/ecore_file_download.c index fd8f2e9..c25b6d5 100644 --- a/src/lib/ecore_file/ecore_file_download.c +++ b/src/lib/ecore_file/ecore_file_download.c @@ -147,7 +147,7 @@ ecore_file_download(const char *url, const char *dst, job = _ecore_file_download_curl(url, dst, completion_cb, progress_cb, data); if(job_ret) *job_ret = job; - return job != NULL; + return !!job; } # endif else diff --git a/src/lib/ecore_win32/ecore_win32_dnd.c b/src/lib/ecore_win32/ecore_win32_dnd.c index c8d3868..415f812 100755 --- a/src/lib/ecore_win32/ecore_win32_dnd.c +++ b/src/lib/ecore_win32/ecore_win32_dnd.c @@ -57,7 +57,7 @@ int ecore_win32_dnd_begin(const char *data, STGMEDIUM stgmed = { TYMED_HGLOBAL, { 0 }, 0 }; int res = 0; - if (data == NULL) + if (!data) return 0; if (size < 0) size = strlen(data) + 1; @@ -108,22 +108,22 @@ int ecore_win32_dnd_register_drop_target(Ecore_Win32_Window *win { struct _Ecore_Win32_Window *wnd = (struct _Ecore_Win32_Window *)window; - if (window == NULL) + if (!window) return 0; wnd->dnd_drop_target = _ecore_win32_dnd_register_drop_window(wnd->window, callback, (void *)wnd); - return (int)(wnd->dnd_drop_target != NULL); + return (int)(!!wnd->dnd_drop_target); } void ecore_win32_dnd_unregister_drop_target(Ecore_Win32_Window *window) { struct _Ecore_Win32_Window *wnd = (struct _Ecore_Win32_Window *)window; - if (window == NULL) + if (!window) return; - if (wnd->dnd_drop_target != NULL) + if (wnd->dnd_drop_target) _ecore_win32_dnd_unregister_drop_window(wnd->window, wnd->dnd_drop_target); } diff --git a/src/lib/ecore_win32/ecore_win32_window.c b/src/lib/ecore_win32/ecore_win32_window.c index d110b0b..102ea69 100644 --- a/src/lib/ecore_win32/ecore_win32_window.c +++ b/src/lib/ecore_win32/ecore_win32_window.c @@ -79,7 +79,7 @@ ecore_win32_window_free(Ecore_Win32_Window *window) INF("destroying window"); - if (wnd->shape.mask != NULL) + if (wnd->shape.mask) free(wnd->shape.mask); DestroyWindow(((struct _Ecore_Win32_Window *)window)->window); @@ -473,12 +473,12 @@ ecore_win32_window_shape_set(Ecore_Win32_Window *window, int y; OSVERSIONINFO version_info; - if (window == NULL) + if (!window) return; wnd = (struct _Ecore_Win32_Window *)window; - if (mask == NULL) + if (!mask) { wnd->shape.enabled = 0; if (wnd->shape.layered != 0) @@ -518,7 +518,7 @@ ecore_win32_window_shape_set(Ecore_Win32_Window *window, { wnd->shape.width = width; wnd->shape.height = height; - if (wnd->shape.mask != NULL) + if (wnd->shape.mask) { free(wnd->shape.mask); wnd->shape.mask = NULL; diff --git a/src/lib/ecore_x/xlib/ecore_x.c b/src/lib/ecore_x/xlib/ecore_x.c index aa1dc16..8bd53ba 100644 --- a/src/lib/ecore_x/xlib/ecore_x.c +++ b/src/lib/ecore_x/xlib/ecore_x.c @@ -591,7 +591,7 @@ ecore_x_init(const char *name) int i; XSetLocaleModifiers("@im=none"); - if ((im = XOpenIM(_ecore_x_disp, NULL, NULL, NULL)) == NULL) + if (!(im = XOpenIM(_ecore_x_disp, NULL, NULL, NULL))) goto _im_create_end; ret = XGetIMValues(im, XNQueryInputStyle, &supported_styles, NULL); diff --git a/src/lib/ecore_x/xlib/ecore_x_image.c b/src/lib/ecore_x/xlib/ecore_x_image.c index 4b8215c..f0d6286 100644 --- a/src/lib/ecore_x/xlib/ecore_x_image.c +++ b/src/lib/ecore_x/xlib/ecore_x_image.c @@ -167,7 +167,7 @@ _ecore_x_image_shm_create(Ecore_X_Image *im) im->shminfo.shmaddr = shmat(im->shminfo.shmid, 0, 0); im->xim->data = im->shminfo.shmaddr; if ((im->xim->data == (char *)-1) || - (im->xim->data == NULL)) + (!im->xim->data)) { shmdt(im->shminfo.shmaddr); shmctl(im->shminfo.shmid, IPC_RMID, 0); diff --git a/src/lib/ecore_x/xlib/ecore_x_randr_12.c b/src/lib/ecore_x/xlib/ecore_x_randr_12.c index a8062cb..7e31730 100644 --- a/src/lib/ecore_x/xlib/ecore_x_randr_12.c +++ b/src/lib/ecore_x/xlib/ecore_x_randr_12.c @@ -1701,7 +1701,7 @@ ecore_x_randr_move_all_crtcs_but(Ecore_X_Window root, Eina_Bool ret; - if ((nnot_moved <= 0) || (not_moved == NULL) + if ((nnot_moved <= 0) || (!not_moved) || !_ecore_x_randr_root_validate(root) || !(res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) diff --git a/src/lib/ecore_x/xlib/ecore_x_window.c b/src/lib/ecore_x/xlib/ecore_x_window.c index ab652d5..1628564 100644 --- a/src/lib/ecore_x/xlib/ecore_x_window.c +++ b/src/lib/ecore_x/xlib/ecore_x_window.c @@ -1438,7 +1438,7 @@ _ecore_x_window_argb_internal_new(Ecore_X_Window parent, VisualClassMask, &vi_in, &nvi); - if (xvi == NULL) + if (!xvi) return 0; vis = NULL; diff --git a/src/tests/ecore_suite.c b/src/tests/ecore_suite.c index 9c7e199..8f5ad26 100644 --- a/src/tests/ecore_suite.c +++ b/src/tests/ecore_suite.c @@ -30,7 +30,7 @@ _list_tests(void) itr = etc; fputs("Available Test Cases:\n", stderr); - for (; itr->test_case != NULL; itr++) + for (; itr->test_case; itr++) fprintf(stderr, "\t%s\n", itr->test_case); } static Eina_Bool @@ -54,7 +54,7 @@ ecore_suite_build(int argc, const char **argv) s = suite_create("Ecore"); - for (i = 0; etc[i].test_case != NULL; ++i) + for (i = 0; etc[i].test_case; ++i) { if (!_use_test(argc, argv, etc[i].test_case)) continue; tc = tcase_create(etc[i].test_case); diff --git a/src/tests/ecore_test_ecore.c b/src/tests/ecore_test_ecore.c index 6f7e30e..cb6212f 100644 --- a/src/tests/ecore_test_ecore.c +++ b/src/tests/ecore_test_ecore.c @@ -49,7 +49,7 @@ START_TEST(ecore_test_ecore_main_loop) fail_if(ret != 1); timer = ecore_timer_add(0.0, _quit_cb, &did); - fail_if(timer == NULL); + fail_if(!timer); ecore_main_loop_begin(); @@ -70,7 +70,7 @@ START_TEST(ecore_test_ecore_main_loop_idler) fail_if(ret != 1); idler = ecore_idler_add(_quit_cb, &did); - fail_if(idler == NULL); + fail_if(!idler); ecore_main_loop_begin(); @@ -91,7 +91,7 @@ START_TEST(ecore_test_ecore_main_loop_idle_enterer) fail_if(ret != 1); idle_enterer = ecore_idle_enterer_add(_quit_cb, &did); - fail_if(idle_enterer == NULL); + fail_if(!idle_enterer); ecore_main_loop_begin(); @@ -114,10 +114,10 @@ START_TEST(ecore_test_ecore_main_loop_idle_exiter) /* make system exit idle */ timer = ecore_timer_add(0.0, _dummy_cb, (void *)(long)0); - fail_if(timer == NULL); + fail_if(!timer); idle_exiter = ecore_idle_exiter_add(_quit_cb, &did); - fail_if(idle_exiter == NULL); + fail_if(!idle_exiter); ecore_main_loop_begin(); @@ -139,7 +139,7 @@ START_TEST(ecore_test_ecore_main_loop_timer) fail_if(ret != 1); timer = ecore_timer_add(2.0, _quit_cb, &did); - fail_if(timer == NULL); + fail_if(!timer); start = ecore_time_get(); ecore_main_loop_begin();