From 5a8a8c90140aa18bde2c1696eb7d2da1c978e15e 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 --- legacy/ecore/src/bin/ecore_config.c | 8 +-- legacy/ecore/src/lib/ecore/ecore_exe.c | 16 ++--- legacy/ecore/src/lib/ecore/ecore_exe_win32.c | 2 +- legacy/ecore/src/lib/ecore/ecore_getopt.c | 18 ++--- legacy/ecore/src/lib/ecore/ecore_main.c | 2 +- legacy/ecore/src/lib/ecore/ecore_pipe.c | 2 +- legacy/ecore/src/lib/ecore_con/ecore_con.c | 8 +-- .../ecore/src/lib/ecore_con/ecore_con_ares.c | 2 +- .../ecore/src/lib/ecore_con/ecore_con_url.c | 8 +-- .../src/lib/ecore_config/ecore_config_extra.c | 2 +- legacy/ecore/src/lib/ecore_evas/ecore_evas.c | 6 +- .../src/lib/ecore_evas/ecore_evas_cocoa.c | 2 +- .../src/lib/ecore_evas/ecore_evas_directfb.c | 2 +- .../ecore/src/lib/ecore_evas/ecore_evas_fb.c | 2 +- .../ecore/src/lib/ecore_evas/ecore_evas_sdl.c | 2 +- .../src/lib/ecore_evas/ecore_evas_win32.c | 4 +- .../src/lib/ecore_evas/ecore_evas_wince.c | 2 +- .../ecore/src/lib/ecore_evas/ecore_evas_x.c | 2 +- legacy/ecore/src/lib/ecore_fb/ecore_fb_ts.c | 2 +- legacy/ecore/src/lib/ecore_file/ecore_file.c | 6 +- .../src/lib/ecore_file/ecore_file_download.c | 2 +- .../src/lib/ecore_win32/ecore_win32_dnd.c | 10 +-- .../src/lib/ecore_win32/ecore_win32_window.c | 8 +-- legacy/ecore/src/lib/ecore_x/xlib/ecore_x.c | 2 +- .../src/lib/ecore_x/xlib/ecore_x_image.c | 2 +- .../src/lib/ecore_x/xlib/ecore_x_randr_12.c | 2 +- .../src/lib/ecore_x/xlib/ecore_x_window.c | 2 +- legacy/ecore/src/tests/ecore_suite.c | 4 +- legacy/ecore/src/tests/ecore_test_ecore.c | 12 ++-- legacy/edje/src/bin/edje_cc_handlers.c | 2 +- legacy/edje/src/bin/edje_cc_parse.c | 2 +- legacy/edje/src/bin/edje_convert.c | 4 +- legacy/edje/src/bin/edje_convert_main.c | 4 +- legacy/edje/src/bin/edje_player.c | 2 +- legacy/edje/src/lib/edje_calc.c | 2 +- legacy/edje/src/lib/edje_convert.c | 4 +- legacy/edje/src/lib/edje_embryo.c | 4 +- legacy/edje/src/lib/edje_entry.c | 2 +- legacy/edje/src/lib/edje_external.c | 2 +- legacy/edje/src/lib/edje_load.c | 8 +-- legacy/edje/src/lib/edje_lua.c | 6 +- legacy/edje/src/lib/edje_match.c | 8 +-- legacy/edje/src/lib/edje_message_queue.c | 2 +- legacy/edje/src/lib/edje_private.h | 2 +- legacy/edje/src/lib/edje_program.c | 8 +-- legacy/edje/src/lib/edje_text.c | 4 +- legacy/edje/src/lib/edje_util.c | 14 ++-- legacy/eet/src/lib/eet_cipher.c | 16 ++--- legacy/eet/src/lib/eet_data.c | 12 ++-- legacy/eet/src/lib/eet_dictionary.c | 8 +-- legacy/eet/src/lib/eet_image.c | 4 +- legacy/eet/src/lib/eet_lib.c | 14 ++-- legacy/eet/src/lib/eet_node.c | 8 +-- legacy/eet/src/tests/eet_suite.c | 66 +++++++++---------- .../efreet/src/lib/efreet_desktop_command.c | 2 +- legacy/efreet/src/lib/efreet_icon.c | 6 +- legacy/efreet/src/lib/efreet_ini.c | 2 +- legacy/efreet/src/lib/efreet_menu.c | 8 +-- .../efreet/src/tests/compare/efreet_alloc.c | 2 +- legacy/efreet/src/tests/ef_data_dirs.c | 12 ++-- legacy/efreet/src/tests/ef_icon_theme.c | 4 +- legacy/efreet/src/tests/ef_locale.c | 2 +- legacy/efreet/src/tests/ef_mime.c | 2 +- legacy/efreet/src/tests/efreet_suite.c | 4 +- legacy/efreet/src/tests/main.c | 4 +- legacy/eina/src/include/eina_safety_checks.h | 4 +- legacy/eina/src/lib/eina_file.c | 2 +- legacy/eina/src/lib/eina_hash.c | 4 +- legacy/eina/src/lib/eina_inlist.c | 12 ++-- legacy/eina/src/lib/eina_list.c | 14 ++-- legacy/eina/src/lib/eina_log.c | 12 ++-- legacy/eina/src/lib/eina_matrixsparse.c | 38 +++++------ legacy/eina/src/lib/eina_rbtree.c | 20 +++--- legacy/eina/src/lib/eina_share_common.c | 4 +- legacy/eina/src/lib/eina_tiler.c | 4 +- legacy/eina/src/tests/ecore_list.c | 10 +-- legacy/eina/src/tests/eina_bench.c | 2 +- legacy/eina/src/tests/eina_suite.c | 4 +- legacy/eina/src/tests/eina_test_binshare.c | 14 ++-- legacy/eina/src/tests/eina_test_hash.c | 10 +-- legacy/eina/src/tests/eina_test_list.c | 34 +++++----- .../eina/src/tests/eina_test_matrixsparse.c | 14 ++-- legacy/eina/src/tests/eina_test_mempool.c | 4 +- legacy/eina/src/tests/eina_test_rbtree.c | 14 ++-- legacy/eina/src/tests/eina_test_str.c | 20 +++--- legacy/eina/src/tests/eina_test_strbuf.c | 4 +- legacy/eina/src/tests/eina_test_stringshare.c | 14 ++-- legacy/eina/src/tests/eina_test_ustr.c | 2 +- .../eina/src/tests/eina_test_ustringshare.c | 4 +- legacy/eina/src/tests/evas_list.c | 4 +- legacy/embryo/src/bin/embryo_cc_sc1.c | 28 ++++---- legacy/embryo/src/bin/embryo_cc_sc2.c | 34 +++++----- legacy/embryo/src/bin/embryo_cc_sc3.c | 60 ++++++++--------- legacy/embryo/src/bin/embryo_cc_sc4.c | 24 +++---- legacy/embryo/src/bin/embryo_cc_sc6.c | 20 +++--- legacy/embryo/src/bin/embryo_cc_sc7.c | 6 +- legacy/embryo/src/bin/embryo_cc_sclist.c | 40 +++++------ legacy/emotion/src/lib/emotion_smart.c | 2 +- .../gstreamer/emotion_gstreamer_pipeline.c | 2 +- .../src/modules/xine/emotion_xine_vo_out.c | 10 +-- legacy/ethumb/src/bin/ethumbd.c | 4 +- .../src/lib/cache/evas_cache_engine_image.c | 12 ++-- legacy/evas/src/lib/cache/evas_cache_image.c | 14 ++-- legacy/evas/src/lib/canvas/evas_clip.c | 2 +- legacy/evas/src/lib/canvas/evas_data.c | 2 +- legacy/evas/src/lib/canvas/evas_object_box.c | 6 +- .../src/lib/canvas/evas_object_intercept.c | 24 +++---- .../evas/src/lib/canvas/evas_object_smart.c | 2 +- .../src/lib/canvas/evas_object_textblock.c | 4 +- legacy/evas/src/lib/canvas/evas_smart.c | 8 +-- legacy/evas/src/lib/cserve/evas_cs_client.c | 10 +-- .../src/lib/engines/common/evas_font_load.c | 4 +- .../src/lib/engines/common/evas_image_main.c | 6 +- .../evas/src/lib/engines/common/evas_pipe.c | 4 +- .../evas/src/lib/engines/common/evas_tiler.c | 12 ++-- legacy/evas/src/lib/file/evas_module.c | 8 +-- .../modules/engines/direct3d/evas_engine.c | 12 ++-- .../engines/software_16_x11/evas_x_buffer.c | 2 +- .../engines/software_8_x11/evas_x_buffer.c | 2 +- .../engines/software_x11/evas_xcb_buffer.c | 2 +- .../engines/software_x11/evas_xlib_buffer.c | 2 +- .../xrender_x11/evas_engine_xcb_ximage.c | 2 +- .../loaders/tiff/evas_image_load_tiff.c | 2 +- .../modules/savers/png/evas_image_save_png.c | 2 +- legacy/evil/src/lib/evil_langinfo.c | 4 +- legacy/evil/src/lib/evil_pwd.c | 2 +- 126 files changed, 523 insertions(+), 523 deletions(-) diff --git a/legacy/ecore/src/bin/ecore_config.c b/legacy/ecore/src/bin/ecore_config.c index 8bf29882dd..b4973d91d1 100644 --- a/legacy/ecore/src/bin/ecore_config.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore/ecore_exe.c b/legacy/ecore/src/lib/ecore/ecore_exe.c index 43b6cf1cc0..e8eec95f2f 100644 --- a/legacy/ecore/src/lib/ecore/ecore_exe.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore/ecore_exe_win32.c b/legacy/ecore/src/lib/ecore/ecore_exe_win32.c index 17448ade0c..30d7d3c25b 100644 --- a/legacy/ecore/src/lib/ecore/ecore_exe_win32.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore/ecore_getopt.c b/legacy/ecore/src/lib/ecore/ecore_getopt.c index 1c1de8be3c..f00c46e513 100644 --- a/legacy/ecore/src/lib/ecore/ecore_getopt.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore/ecore_main.c b/legacy/ecore/src/lib/ecore/ecore_main.c index 7530114af1..10a4fd3439 100644 --- a/legacy/ecore/src/lib/ecore/ecore_main.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore/ecore_pipe.c b/legacy/ecore/src/lib/ecore/ecore_pipe.c index 87f90382ab..9c26133efd 100644 --- a/legacy/ecore/src/lib/ecore/ecore_pipe.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_con/ecore_con.c b/legacy/ecore/src/lib/ecore_con/ecore_con.c index 97b674337f..e25c712a51 100644 --- a/legacy/ecore/src/lib/ecore_con/ecore_con.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_con/ecore_con_ares.c b/legacy/ecore/src/lib/ecore_con/ecore_con_ares.c index 243c16fd45..b67606719f 100644 --- a/legacy/ecore/src/lib/ecore_con/ecore_con_ares.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_con/ecore_con_url.c b/legacy/ecore/src/lib/ecore_con/ecore_con_url.c index 27b1b61574..09a0e8c4e5 100644 --- a/legacy/ecore/src/lib/ecore_con/ecore_con_url.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_config/ecore_config_extra.c b/legacy/ecore/src/lib/ecore_config/ecore_config_extra.c index 6a92dd8b49..6d47c8175b 100644 --- a/legacy/ecore/src/lib/ecore_config/ecore_config_extra.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_evas/ecore_evas.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas.c index ab4d87be49..ca1fdf2337 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c index 7ebdb4c74f..bdc7cd4bdb 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_evas/ecore_evas_directfb.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_directfb.c index 0b2a17418c..b3cf77ce83 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_directfb.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c index 7403c1297b..3f974d5b22 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_evas/ecore_evas_sdl.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_sdl.c index e555011c1d..6a559270ba 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_sdl.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_evas/ecore_evas_win32.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_win32.c index 7c1f236539..e1d283b743 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_win32.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c index f1cbdca5bd..1c3cbb4dcb 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_evas/ecore_evas_x.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_x.c index 09a636f380..e863b64ead 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_x.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_fb/ecore_fb_ts.c b/legacy/ecore/src/lib/ecore_fb/ecore_fb_ts.c index c106ecc967..c1e1f08076 100644 --- a/legacy/ecore/src/lib/ecore_fb/ecore_fb_ts.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_file/ecore_file.c b/legacy/ecore/src/lib/ecore_file/ecore_file.c index 32298965e6..ec0a1f72ba 100644 --- a/legacy/ecore/src/lib/ecore_file/ecore_file.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_file/ecore_file_download.c b/legacy/ecore/src/lib/ecore_file/ecore_file_download.c index fd8f2e9d4e..c25b6d581f 100644 --- a/legacy/ecore/src/lib/ecore_file/ecore_file_download.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_win32/ecore_win32_dnd.c b/legacy/ecore/src/lib/ecore_win32/ecore_win32_dnd.c index c8d386844b..415f812535 100755 --- a/legacy/ecore/src/lib/ecore_win32/ecore_win32_dnd.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_win32/ecore_win32_window.c b/legacy/ecore/src/lib/ecore_win32/ecore_win32_window.c index d110b0bfca..102ea69f8f 100644 --- a/legacy/ecore/src/lib/ecore_win32/ecore_win32_window.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_x/xlib/ecore_x.c b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x.c index aa1dc1602f..8bd53bad62 100644 --- a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_image.c b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_image.c index 4b8215cc2f..f0d62866d5 100644 --- a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_image.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c index a8062cbe03..7e31730ea7 100644 --- a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_window.c b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_window.c index ab652d5f38..162856480c 100644 --- a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_window.c +++ b/legacy/ecore/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/legacy/ecore/src/tests/ecore_suite.c b/legacy/ecore/src/tests/ecore_suite.c index 9c7e199d19..8f5ad266aa 100644 --- a/legacy/ecore/src/tests/ecore_suite.c +++ b/legacy/ecore/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/legacy/ecore/src/tests/ecore_test_ecore.c b/legacy/ecore/src/tests/ecore_test_ecore.c index 6f7e30e0ed..cb6212fb84 100644 --- a/legacy/ecore/src/tests/ecore_test_ecore.c +++ b/legacy/ecore/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(); diff --git a/legacy/edje/src/bin/edje_cc_handlers.c b/legacy/edje/src/bin/edje_cc_handlers.c index 79749a7d4c..b309a6e746 100644 --- a/legacy/edje/src/bin/edje_cc_handlers.c +++ b/legacy/edje/src/bin/edje_cc_handlers.c @@ -1734,7 +1734,7 @@ ob_collections_group(void) Edje_Part_Collection *pc; Code *cd; - if (current_de != NULL && current_de->entry == NULL) + if (current_de && !current_de->entry) { ERR("%p: Error. A collection without a name was detected, that's not allowed.", progname); exit(-1); diff --git a/legacy/edje/src/bin/edje_cc_parse.c b/legacy/edje/src/bin/edje_cc_parse.c index effe5f3115..1c63b5f992 100644 --- a/legacy/edje/src/bin/edje_cc_parse.c +++ b/legacy/edje/src/bin/edje_cc_parse.c @@ -445,7 +445,7 @@ parse(char *data, off_t size) p = data; end = data + size; line = 1; - while ((token = next_token(p, end, &p, &delim)) != NULL) + while ((token = next_token(p, end, &p, &delim))) { /* if we are in param mode, the only delimiter * we'll accept is the semicolon diff --git a/legacy/edje/src/bin/edje_convert.c b/legacy/edje/src/bin/edje_convert.c index 7e9a73e988..5b05da93a9 100644 --- a/legacy/edje/src/bin/edje_convert.c +++ b/legacy/edje/src/bin/edje_convert.c @@ -269,8 +269,8 @@ _edje_collection_convert(Eet_File *ef, Edje_Part_Collection_Directory_Entry *ce, _edje_collection_program_add(&edc->programs.nocmp, &edc->programs.nocmp_count, pg); - else if (pg->signal && strpbrk(pg->signal, "*?[\\") == NULL - && pg->source && strpbrk(pg->source, "*?[\\") == NULL) + else if (pg->signal && !strpbrk(pg->signal, "*?[\\") + && pg->source && !strpbrk(pg->source, "*?[\\")) _edje_collection_program_add(&edc->programs.strcmp, &edc->programs.strcmp_count, pg); diff --git a/legacy/edje/src/bin/edje_convert_main.c b/legacy/edje/src/bin/edje_convert_main.c index 5ab5ef98c0..b241d770d6 100644 --- a/legacy/edje/src/bin/edje_convert_main.c +++ b/legacy/edje/src/bin/edje_convert_main.c @@ -57,7 +57,7 @@ _edje_alias_int(const char *target, Eet_File *ef, const char *base, const char * snprintf(buf, sizeof (buf), "%s/", base); strcat(buf, "%i"); - for (i = 0; i < count && match != NULL; ++i) + for (i = 0; i < count && match; ++i) { char name[1024]; int id; @@ -87,7 +87,7 @@ _edje_alias_string(const char *target, Eet_File *ef, const char *base, const cha snprintf(buf, sizeof (buf), "%s/", base); strcat(buf, "%s"); - for (i = 0; i < count && match != NULL; ++i) + for (i = 0; i < count && match; ++i) { char name[1024]; char id[1024]; diff --git a/legacy/edje/src/bin/edje_player.c b/legacy/edje/src/bin/edje_player.c index bc65d7ff90..2c8d54b352 100644 --- a/legacy/edje/src/bin/edje_player.c +++ b/legacy/edje/src/bin/edje_player.c @@ -226,7 +226,7 @@ _slave_mode(void *data, Ecore_Fd_Handler *fd_handler) } } - for (itr = _slave_mode_commands; itr->cmd != NULL; itr++) + for (itr = _slave_mode_commands; itr->cmd; itr++) { if (strcmp(itr->cmd, buf) == 0) { diff --git a/legacy/edje/src/lib/edje_calc.c b/legacy/edje/src/lib/edje_calc.c index 2cc3f8cf1a..b339edb37f 100644 --- a/legacy/edje/src/lib/edje_calc.c +++ b/legacy/edje/src/lib/edje_calc.c @@ -125,7 +125,7 @@ _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, doubl epdi = (Edje_Part_Description_Image*) epd2; /* There is an animation if both description are different or if description is an image with tweens */ - if (epd2 != NULL && (epd1 != epd2 || (ep->part->type == EDJE_PART_TYPE_IMAGE && epdi->image.tweens_count))) + if (epd2 && (epd1 != epd2 || (ep->part->type == EDJE_PART_TYPE_IMAGE && epdi->image.tweens_count))) { if (!ep->param2) { diff --git a/legacy/edje/src/lib/edje_convert.c b/legacy/edje/src/lib/edje_convert.c index 58dccc2033..6b183fd466 100644 --- a/legacy/edje/src/lib/edje_convert.c +++ b/legacy/edje/src/lib/edje_convert.c @@ -321,8 +321,8 @@ _edje_collection_convert(Edje_File *file, Old_Edje_Part_Collection *oedc) _edje_collection_program_add(&edc->programs.nocmp, &edc->programs.nocmp_count, pg); - else if (pg->signal && strpbrk(pg->signal, "*?[\\") == NULL - && pg->source && strpbrk(pg->source, "*?[\\") == NULL) + else if (pg->signal && !strpbrk(pg->signal, "*?[\\") + && pg->source && !strpbrk(pg->source, "*?[\\")) _edje_collection_program_add(&edc->programs.strcmp, &edc->programs.strcmp_count, pg); diff --git a/legacy/edje/src/lib/edje_embryo.c b/legacy/edje/src/lib/edje_embryo.c index 96e9cb8b64..bcaa25aaf8 100644 --- a/legacy/edje/src/lib/edje_embryo.c +++ b/legacy/edje/src/lib/edje_embryo.c @@ -1152,7 +1152,7 @@ _edje_embryo_fn_get_color_class(Embryo_Program *ep, Embryo_Cell *params) GETSTR(class, params[1]); if (!class) return 0; c_class = _edje_color_class_find(ed, class); - if (c_class == NULL) return 0; + if (!c_class) return 0; SETINT(c_class->r, params[2]); SETINT(c_class->g, params[3]); SETINT(c_class->b, params[4]); @@ -1208,7 +1208,7 @@ _edje_embryo_fn_get_text_class(Embryo_Program *ep, Embryo_Cell *params) GETSTR(class, params[1]); if (!class) return 0; t_class = _edje_text_class_find(ed, class); - if (t_class == NULL) return 0; + if (!t_class) return 0; SETSTR((char *)t_class->font, params[2]); SETFLOAT(t_class->size, params[3]); return 0; diff --git a/legacy/edje/src/lib/edje_entry.c b/legacy/edje/src/lib/edje_entry.c index 16ae0ec071..438ee5f31e 100644 --- a/legacy/edje/src/lib/edje_entry.c +++ b/legacy/edje/src/lib/edje_entry.c @@ -130,7 +130,7 @@ _edje_focus_in_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v _edje_emit(ed, "focus,in", ""); #ifdef HAVE_ECORE_IMF rp = ed->focused_part; - if (rp == NULL) return; + if (!rp) return; en = rp->entry_data; if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) || diff --git a/legacy/edje/src/lib/edje_external.c b/legacy/edje/src/lib/edje_external.c index bf60d24212..b25e21e9f3 100644 --- a/legacy/edje/src/lib/edje_external.c +++ b/legacy/edje/src/lib/edje_external.c @@ -239,7 +239,7 @@ edje_object_part_external_param_type_get(const Evas_Object *obj, const char *par type->module_name); return EDJE_EXTERNAL_PARAM_TYPE_MAX; } - for (info = type->parameters_info; info->name != NULL; info++) + for (info = type->parameters_info; info->name; info++) if (strcmp(info->name, param) == 0) return info->type; diff --git a/legacy/edje/src/lib/edje_load.c b/legacy/edje/src/lib/edje_load.c index 4d2acfd63b..f07578b25d 100644 --- a/legacy/edje/src/lib/edje_load.c +++ b/legacy/edje/src/lib/edje_load.c @@ -139,7 +139,7 @@ edje_file_collection_list(const char *file) if ((!file) || (!*file)) return NULL; edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL); - if (edf != NULL) + if (edf) { Eina_Iterator *i; const char *key; @@ -186,7 +186,7 @@ edje_file_group_exists(const char *file, const char *glob) if ((!file) || (!*file)) return EINA_FALSE; edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL); - if (edf != NULL) + if (edf) { Edje_Patterns *patterns; @@ -246,7 +246,7 @@ edje_file_data_get(const char *file, const char *key) if (key) { edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL); - if (edf != NULL) + if (edf) { str = (char*) edje_string_get(eina_hash_find(edf->data, key)); @@ -883,7 +883,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g void _edje_file_add(Edje *ed) { - if (_edje_edd_edje_file == NULL) return; + if (!_edje_edd_edje_file) return; ed->file = _edje_cache_file_coll_open(ed->path, ed->group, &(ed->load_error), &(ed->collection)); diff --git a/legacy/edje/src/lib/edje_lua.c b/legacy/edje/src/lib/edje_lua.c index b01d0adc6e..c29e83902c 100644 --- a/legacy/edje/src/lib/edje_lua.c +++ b/legacy/edje/src/lib/edje_lua.c @@ -385,7 +385,7 @@ _edje_lua_new_class(lua_State *L, const Edje_Lua_Reg ** class) { int n = 0; _edje_lua_new_metatable(L, class); - while (class && (class[n] != NULL)) + while (class && (class[n])) { luaL_register(L, NULL, class[n]->mt); lua_pushstring(L, "hands off, it's none of your business!"); @@ -5075,7 +5075,7 @@ _edje_lua_alloc(void *ud, void *ptr, size_t osize, size_t nsize) void _edje_lua_init() { - if (Ledje != NULL) return; + if (Ledje) return; /* * create main Lua state with the custom memory allocation function */ @@ -5161,7 +5161,7 @@ _edje_lua_init() void _edje_lua_shutdown() { - if (Ledje == NULL) return; + if (!Ledje) return; lua_close(Ledje); Ledje = NULL; } diff --git a/legacy/edje/src/lib/edje_match.c b/legacy/edje/src/lib/edje_match.c index 85aa3b123d..b9ff606103 100644 --- a/legacy/edje/src/lib/edje_match.c +++ b/legacy/edje/src/lib/edje_match.c @@ -673,8 +673,8 @@ edje_match_program_hash_build(Edje_Program * const *programs, for (i = 0; i < count; ++i) { - if (programs[i]->signal && strpbrk(programs[i]->signal, "*?[\\") == NULL - && programs[i]->source && strpbrk(programs[i]->source, "*?[\\") == NULL) + if (programs[i]->signal && !strpbrk(programs[i]->signal, "*?[\\") + && programs[i]->source && !strpbrk(programs[i]->source, "*?[\\")) { Edje_Signal_Source_Char *item; @@ -714,8 +714,8 @@ edje_match_callback_hash_build(const Eina_List *callbacks, EINA_LIST_FOREACH(callbacks, l, callback) { - if (callback->signal && strpbrk(callback->signal, "*?[\\") == NULL - && callback->source && strpbrk(callback->source, "*?[\\") == NULL) + if (callback->signal && !strpbrk(callback->signal, "*?[\\") + && callback->source && !strpbrk(callback->source, "*?[\\")) { Edje_Signal_Source_Char *item; diff --git a/legacy/edje/src/lib/edje_message_queue.c b/legacy/edje/src/lib/edje_message_queue.c index 25b0dcb0e3..3ffb137c93 100644 --- a/legacy/edje/src/lib/edje_message_queue.c +++ b/legacy/edje/src/lib/edje_message_queue.c @@ -691,7 +691,7 @@ _edje_message_queue_process(void) { int i; - if (msgq == NULL) return; + if (!msgq) return; /* allow the message queue to feed itself up to 8 times before forcing */ /* us to go back to normal processing and let a 0 timeout deal with it */ diff --git a/legacy/edje/src/lib/edje_private.h b/legacy/edje/src/lib/edje_private.h index 15eda5472f..d962bd412d 100644 --- a/legacy/edje/src/lib/edje_private.h +++ b/legacy/edje/src/lib/edje_private.h @@ -1749,7 +1749,7 @@ edje_program_is_strrncmp(const char *str) { if (*str != '*' && *str != '?') return EINA_FALSE; - if (strpbrk(str + 1, "*?[\\") != NULL) + if (strpbrk(str + 1, "*?[\\")) return EINA_FALSE; return EINA_TRUE; } diff --git a/legacy/edje/src/lib/edje_program.c b/legacy/edje/src/lib/edje_program.c index fdaaf237d2..53092d4450 100644 --- a/legacy/edje/src/lib/edje_program.c +++ b/legacy/edje/src/lib/edje_program.c @@ -844,7 +844,7 @@ _edje_program_run(Edje *ed, Edje_Program *pr, Eina_Bool force, const char *ssig, #ifdef LUA2 _edje_lua2_script_init(ed); #else - if (ed->L == NULL) /* private state does not yet exist, create it */ + if (!ed->L) /* private state does not yet exist, create it */ { ed->L = _edje_lua_new_thread(ed, _edje_lua_state_get()); } @@ -1032,7 +1032,7 @@ _edje_emit(Edje *ed, const char *sig, const char *src) /* The part contain a [index], retrieve it */ idx = strchr(sig, EDJE_PART_PATH_SEPARATOR_INDEXL); - if (idx == NULL || sep < idx) newsig = part + (sep - sig); + if (!idx || sep < idx) newsig = part + (sep - sig); else newsig = part + (idx - sig); *newsig = '\0'; @@ -1391,7 +1391,7 @@ _edje_external_param_info_get(const Evas_Object *obj, const char *name) type = evas_object_data_get(obj, "Edje_External_Type"); if (!type) return NULL; - for (info = type->parameters_info; info->name != NULL; info++) + for (info = type->parameters_info; info->name; info++) if (!strcmp(info->name, name)) return info; return NULL; @@ -1974,7 +1974,7 @@ _edje_param_validate(const Edje_External_Param *param, const Edje_External_Param { const char **itr = info->info.c.choices; if (!itr) return EINA_FALSE; - for (; *itr != NULL; itr++) + for (; *itr; itr++) if (!strcmp(*itr, param->s)) return EINA_TRUE; return EINA_FALSE; diff --git a/legacy/edje/src/lib/edje_text.c b/legacy/edje/src/lib/edje_text.c index 23dd35fe0e..2fdb0c53eb 100644 --- a/legacy/edje/src/lib/edje_text.c +++ b/legacy/edje/src/lib/edje_text.c @@ -394,7 +394,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep, if (ep->text.cache.in_str) eina_stringshare_del(ep->text.cache.in_str); ep->text.cache.in_str = eina_stringshare_add(text); ep->text.cache.in_size = size; - if (chosen_desc->text.fit_x && (ep->text.cache.in_str != NULL && eina_stringshare_strlen(ep->text.cache.in_str) > 0)) + if (chosen_desc->text.fit_x && (ep->text.cache.in_str && eina_stringshare_strlen(ep->text.cache.in_str) > 0)) { if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path); else evas_object_text_font_source_set(ep->object, NULL); @@ -437,7 +437,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep, } } } - if (chosen_desc->text.fit_y && (ep->text.cache.in_str != NULL && eina_stringshare_strlen(ep->text.cache.in_str) > 0)) + if (chosen_desc->text.fit_y && (ep->text.cache.in_str && eina_stringshare_strlen(ep->text.cache.in_str) > 0)) { /* if we fit in the x axis, too, size already has a somewhat * meaningful value, so don't overwrite it with the starting diff --git a/legacy/edje/src/lib/edje_util.c b/legacy/edje/src/lib/edje_util.c index 04c556cf2f..7e49f2aec8 100644 --- a/legacy/edje/src/lib/edje_util.c +++ b/legacy/edje/src/lib/edje_util.c @@ -2342,7 +2342,7 @@ _edje_box_layout_builtin_find(const char *name) return NULL; } - for (; (base->name != NULL) && (base->name[0] == name[0]); base++) + for (; (base->name) && (base->name[0] == name[0]); base++) if (strcmp(base->name, name) == 0) return base->cb; @@ -4311,13 +4311,13 @@ _edje_real_part_recursive_get_helper(Edje *ed, char **path) if (alias) { rp = _edje_real_part_recursive_get(ed, alias); - if (path[1] == NULL) return rp; + if (!path[1]) return rp; if (!rp) return NULL; } else { rp = _edje_real_part_get(ed, path[0]); - if (path[1] == NULL) return rp; + if (!path[1]) return rp; if (!rp) return NULL; } @@ -4841,8 +4841,8 @@ _edje_program_remove(Edje_Part_Collection *edc, Edje_Program *p) array = &edc->programs.nocmp; count = &edc->programs.nocmp_count; } - else if (p->signal && strpbrk(p->signal, "*?[\\") == NULL - && p->source && strpbrk(p->source, "*?[\\") == NULL) + else if (p->signal && !strpbrk(p->signal, "*?[\\") + && p->source && !strpbrk(p->source, "*?[\\")) { array = &edc->programs.strcmp; count = &edc->programs.strcmp_count; @@ -4885,8 +4885,8 @@ _edje_program_insert(Edje_Part_Collection *edc, Edje_Program *p) array = &edc->programs.nocmp; count = &edc->programs.nocmp_count; } - else if (p->signal && strpbrk(p->signal, "*?[\\") == NULL - && p->source && strpbrk(p->source, "*?[\\") == NULL) + else if (p->signal && !strpbrk(p->signal, "*?[\\") + && p->source && !strpbrk(p->source, "*?[\\")) { array = &edc->programs.strcmp; count = &edc->programs.strcmp_count; diff --git a/legacy/eet/src/lib/eet_cipher.c b/legacy/eet/src/lib/eet_cipher.c index 782175904d..4b44143587 100644 --- a/legacy/eet/src/lib/eet_cipher.c +++ b/legacy/eet/src/lib/eet_cipher.c @@ -426,7 +426,7 @@ on_error: void eet_identity_ref(Eet_Key *key) { - if (key == NULL) + if (!key) return; key->references++; @@ -435,7 +435,7 @@ eet_identity_ref(Eet_Key *key) void eet_identity_unref(Eet_Key *key) { - if (key == NULL) + if (!key) return; key->references--; @@ -573,7 +573,7 @@ eet_identity_sign(FILE *fp, # else /* ifdef HAVE_GNUTLS */ sign_len = EVP_PKEY_size(key->private_key); sign = malloc(sign_len); - if (sign == NULL) + if (!sign) { err = EET_ERROR_OUT_OF_MEMORY; goto on_error; @@ -717,7 +717,7 @@ eet_identity_check(const void *data_base, gcry_md_write(md, data_base, data_length); hash = gcry_md_read(md, GCRY_MD_SHA1); - if (hash == NULL) + if (!hash) { gcry_md_close(md); return NULL; @@ -773,12 +773,12 @@ eet_identity_check(const void *data_base, tmp = alloca(cert_len); memcpy((char *)tmp, cert_der, cert_len); x509 = d2i_X509(NULL, &tmp, cert_len); - if (x509 == NULL) + if (!x509) return NULL; /* Get public key - eay */ pkey = X509_get_pubkey(x509); - if (pkey == NULL) + if (!pkey) { X509_free(x509); return NULL; @@ -864,7 +864,7 @@ on_error: tmp = alloca(der_length); memcpy((char *)tmp, certificate, der_length); x509 = d2i_X509(NULL, &tmp, der_length); - if (x509 == NULL) + if (!x509) { INF("Not a valid certificate."); return; @@ -1236,7 +1236,7 @@ eet_hmac_sha1(const void *key, gcry_md_write(mdh, data, data_len); hash = gcry_md_read(mdh, GCRY_MD_SHA1); - if (hash == NULL) + if (!hash) { gcry_md_close(mdh); return 1; diff --git a/legacy/eet/src/lib/eet_data.c b/legacy/eet/src/lib/eet_data.c index 995d55b3da..2ae5246494 100644 --- a/legacy/eet/src/lib/eet_data.c +++ b/legacy/eet/src/lib/eet_data.c @@ -727,7 +727,7 @@ eet_data_get_string(const Eet_Dictionary *ed, return -1; str = eet_dictionary_string_get_char(ed, idx); - if (str == NULL) + if (!str) return -1; *d = (char *)str; @@ -735,7 +735,7 @@ eet_data_get_string(const Eet_Dictionary *ed, } s = (char *)src; - if (s == NULL) + if (!s) { *d = NULL; return 0; @@ -1873,7 +1873,7 @@ eet_data_descriptor_element_add(Eet_Data_Descriptor *edd, || group_type == EET_G_VARIANT) && (type != EET_T_UNKNOW - || subtype == NULL + || !subtype || subtype->func.type_get == NULL || subtype->func.type_set == NULL)) return; @@ -1918,7 +1918,7 @@ eet_data_descriptor_element_add(Eet_Data_Descriptor *edd, && (group_type < EET_G_LAST) && (((type > EET_T_UNKNOW) && (type < EET_T_STRING)) || ((type > EET_T_NULL) && (type < EET_T_LAST))) - && (subtype == NULL)) + && (!subtype)) { subtype = calloc(1, sizeof (Eet_Data_Descriptor)); if (!subtype) @@ -2522,7 +2522,7 @@ _eet_data_dump_encode(int parent_type, _eet_data_words_bigendian = 0; } - if (node == NULL) + if (!node) return NULL; ds = eet_data_stream_new(); @@ -4123,7 +4123,7 @@ eet_data_get_unknown(Eet_Free_Context *context, str = (char **)(((char *)data)); if (*str) { - if ((ed == NULL) || (edd->func.str_direct_alloc == NULL)) + if ((!ed) || (edd->func.str_direct_alloc == NULL)) { *str = edd->func.str_alloc(*str); _eet_freelist_str_add(context, *str); diff --git a/legacy/eet/src/lib/eet_dictionary.c b/legacy/eet/src/lib/eet_dictionary.c index 7e86d0858f..23ef3b04c4 100644 --- a/legacy/eet/src/lib/eet_dictionary.c +++ b/legacy/eet/src/lib/eet_dictionary.c @@ -110,7 +110,7 @@ eet_dictionary_string_add(Eet_Dictionary *ed, total = ed->total + 8; new = realloc(ed->all, sizeof (Eet_String) * total); - if (new == NULL) + if (!new) return -1; ed->all = new; @@ -119,7 +119,7 @@ eet_dictionary_string_add(Eet_Dictionary *ed, len = strlen(string) + 1; str = strdup(string); - if (str == NULL) + if (!str) return -1; current = ed->all + ed->count; @@ -201,7 +201,7 @@ eet_dictionary_string_get_char(const Eet_Dictionary *ed, { #ifdef _WIN32 /* Windows file system could change the mmaped file when replacing a file. So we need to copy all string in memory to avoid bugs. */ - if (ed->all[idx].str == NULL) + if (!ed->all[idx].str) { ed->all[idx].str = strdup(ed->all[idx].mmap); ed->all[idx].mmap = NULL; @@ -397,7 +397,7 @@ eet_dictionary_string_check(Eet_Dictionary *ed, { int i; - if ((ed == NULL) || (string == NULL)) + if ((!ed) || (!string)) return 0; if ((ed->start <= string) && (string < ed->end)) diff --git a/legacy/eet/src/lib/eet_image.c b/legacy/eet/src/lib/eet_image.c index 9c52dfd6a7..446ec3d58f 100644 --- a/legacy/eet/src/lib/eet_image.c +++ b/legacy/eet/src/lib/eet_image.c @@ -146,7 +146,7 @@ _eet_jpeg_membuf_dst_flush(j_compress_ptr cinfo) unsigned char *buf; if (dst->len >= 0x40000000 || - (buf = realloc(dst->buf, dst->len * 2)) == NULL) + !(buf = realloc(dst->buf, dst->len * 2))) { dst->failed = 1; dst->pub.next_output_byte = dst->buf; @@ -1279,7 +1279,7 @@ eet_data_image_encode_cipher(const void *data, /* eet_data_image_lossless_compressed_convert will refuse to compress something if the result is bigger than the entry. */ - if (comp <= 0 || d == NULL) + if (comp <= 0 || !d) d = eet_data_image_lossless_convert(&size, data, w, h, alpha); } else diff --git a/legacy/eet/src/lib/eet_lib.c b/legacy/eet/src/lib/eet_lib.c index c1ca7fad66..b736fc045d 100644 --- a/legacy/eet/src/lib/eet_lib.c +++ b/legacy/eet/src/lib/eet_lib.c @@ -1117,7 +1117,7 @@ eet_internal_read2(Eet_File *ef) &ef->signature_length, &ef->x509_length); - if (eet_test_close(ef->x509_der == NULL, ef)) + if (eet_test_close(!ef->x509_der, ef)) return NULL; #else /* ifdef HAVE_SIGNATURE */ @@ -1264,7 +1264,7 @@ eet_internal_read1(Eet_File *ef) if (efn->free_name) { efn->name = malloc(sizeof(char) * name_size + 1); - if (eet_test_close(efn->name == NULL, ef)) + if (eet_test_close(!efn->name, ef)) { free(efn); return NULL; @@ -1318,7 +1318,7 @@ eet_internal_read(Eet_File *ef) { const int *data = (const int *)ef->data; - if (eet_test_close((ef->data == (void *)-1) || (ef->data == NULL), ef)) + if (eet_test_close((ef->data == (void *)-1) || (!ef->data), ef)) return NULL; if (eet_test_close(ef->data_size < (int)sizeof(int) * 3, ef)) @@ -1454,7 +1454,7 @@ eet_memopen_read(const void *data, { Eet_File *ef; - if (data == NULL || size == 0) + if (!data || size == 0) return NULL; ef = malloc (sizeof (Eet_File)); @@ -1552,7 +1552,7 @@ eet_open(const char *file, } open_error: - if (fp == NULL && mode == EET_FILE_MODE_READ) + if (!fp && mode == EET_FILE_MODE_READ) goto on_error; } else @@ -1579,7 +1579,7 @@ open_error: if (ef) { /* reference it up and return it */ - if (fp != NULL) + if (fp) fclose(fp); ef->references++; @@ -2385,7 +2385,7 @@ eet_delete(Eet_File *ef, if (efn->data) free(efn->data); - if (pefn == NULL) + if (!pefn) ef->header->directory->nodes[hash] = efn->next; else pefn->next = efn->next; diff --git a/legacy/eet/src/lib/eet_node.c b/legacy/eet/src/lib/eet_node.c index fd4f07a09d..db1c58c0ed 100644 --- a/legacy/eet/src/lib/eet_node.c +++ b/legacy/eet/src/lib/eet_node.c @@ -606,7 +606,7 @@ eet_node_dump(Eet_Node *n, dumpfunc(dumpdata, "\";\n"); } - for (it = n->values; it != NULL; it = it->next) + for (it = n->values; it; it = it->next) eet_node_dump(it, dumplevel + 2, dumpfunc, dumpdata); eet_node_dump_group_end(dumplevel, dumpfunc, dumpdata); @@ -653,7 +653,7 @@ eet_node_walk(void *parent, case EET_G_UNKNOWN: me = cb->struct_alloc(root->name, user_data); - for (it = root->values; it != NULL; it = it->next) + for (it = root->values; it; it = it->next) eet_node_walk(me, it->name, it, cb, user_data); break; @@ -663,7 +663,7 @@ eet_node_walk(void *parent, me = cb->array(root->type == EET_G_VAR_ARRAY ? EINA_TRUE : EINA_FALSE, root->name, root->count, user_data); - for (i = 0, it = root->values; it != NULL; it = it->next) + for (i = 0, it = root->values; it; it = it->next) cb->insert(me, i++, eet_node_walk(NULL, NULL, it, @@ -675,7 +675,7 @@ eet_node_walk(void *parent, case EET_G_LIST: me = cb->list(root->name, user_data); - for (it = root->values; it != NULL; it = it->next) + for (it = root->values; it; it = it->next) cb->append(me, eet_node_walk(NULL, NULL, it, diff --git a/legacy/eet/src/tests/eet_suite.c b/legacy/eet/src/tests/eet_suite.c index 9c4d5f0a1c..408fcf5b6b 100644 --- a/legacy/eet/src/tests/eet_suite.c +++ b/legacy/eet/src/tests/eet_suite.c @@ -203,13 +203,13 @@ _eet_test_basic_check(Eet_Test_Basic_Type * result, int i) fail_if(tmp > 0.00005); - fail_if(result->empty != NULL); + fail_if(!!result->empty); if (i == 0) { Eet_Test_Basic_Type * tmp; tmp = result->with; - fail_if(tmp == NULL); + fail_if(!tmp); fail_if(tmp->c != EET_TEST_CHAR); fail_if(tmp->s != EET_TEST_SHORT); @@ -223,7 +223,7 @@ _eet_test_basic_check(Eet_Test_Basic_Type * result, int i) fail_if(tmp->ul != EET_TEST_LONG_LONG); } else - fail_if(result->with != NULL); + fail_if(!!result->with); } /* _eet_test_basic_check */ static void @@ -895,7 +895,7 @@ START_TEST(eet_file_simple_write) fail_if(eet_mode_get(ef) != EET_FILE_MODE_WRITE); - fail_if(eet_list(ef, "*", &size) != NULL); + fail_if(!!eet_list(ef, "*", &size)); fail_if(eet_num_entries(ef) != -1); eet_close(ef); @@ -1036,11 +1036,11 @@ START_TEST(eet_file_data_test) /* Test the resulting data. */ fail_if(_eet_test_ex_check(result, 0) != 0); fail_if(_eet_test_ex_check(eina_list_data_get(result->list), 1) != 0); - fail_if(eina_list_data_get(result->ilist) == NULL); + fail_if(!eina_list_data_get(result->ilist)); fail_if(*((int *)eina_list_data_get(result->ilist)) != 42); - fail_if(eina_list_data_get(result->slist) == NULL); + fail_if(!eina_list_data_get(result->slist)); fail_if(strcmp(eina_list_data_get(result->slist), "test") != 0); - fail_if(eina_hash_find(result->shash, EET_TEST_KEY1) == NULL); + fail_if(!eina_hash_find(result->shash, EET_TEST_KEY1)); fail_if(strcmp(eina_hash_find(result->shash, EET_TEST_KEY1), "test") != 0); fail_if(strcmp(result->charray[0], "test") != 0); @@ -1074,13 +1074,13 @@ START_TEST(eet_file_data_test) fail_if(eet_num_entries(ef) != 1); /* Test some more wrong case */ - fail_if(eet_data_read(ef, edd, "plop") != NULL); - fail_if(eet_data_read(ef, edd, EET_TEST_FILE_KEY1) != NULL); + fail_if(!!eet_data_read(ef, edd, "plop")); + fail_if(!!eet_data_read(ef, edd, EET_TEST_FILE_KEY1)); /* Reinsert and reread data */ fail_if(!eet_data_write(ef, edd, EET_TEST_FILE_KEY1, &etbt, 0)); - fail_if(eet_data_read(ef, edd, EET_TEST_FILE_KEY1) == NULL); - fail_if(eet_read_direct(ef, EET_TEST_FILE_KEY1, &size) == NULL); + fail_if(!eet_data_read(ef, edd, EET_TEST_FILE_KEY1)); + fail_if(!eet_read_direct(ef, EET_TEST_FILE_KEY1, &size)); eet_close(ef); @@ -1163,11 +1163,11 @@ START_TEST(eet_file_data_dump_test) /* Test the resulting data. */ fail_if(_eet_test_ex_check(result, 0) != 0); fail_if(_eet_test_ex_check(eina_list_data_get(result->list), 1) != 0); - fail_if(eina_list_data_get(result->ilist) == NULL); + fail_if(!eina_list_data_get(result->ilist)); fail_if(*((int *)eina_list_data_get(result->ilist)) != 42); - fail_if(eina_list_data_get(result->slist) == NULL); + fail_if(!eina_list_data_get(result->slist)); fail_if(strcmp(eina_list_data_get(result->slist), "test") != 0); - fail_if(eina_hash_find(result->shash, EET_TEST_KEY1) == NULL); + fail_if(!eina_hash_find(result->shash, EET_TEST_KEY1)); fail_if(strcmp(eina_hash_find(result->shash, EET_TEST_KEY1), "test") != 0); fail_if(strcmp(result->charray[0], "test") != 0); @@ -1307,7 +1307,7 @@ START_TEST(eet_image) &compress, &quality, &lossy); - fail_if(data == NULL); + fail_if(!data); fail_if(w != test_noalpha.w); fail_if(h != test_noalpha.h); fail_if(alpha != test_noalpha.alpha); @@ -1353,7 +1353,7 @@ START_TEST(eet_image) fail_if(lossy != 0); data = malloc(w * h * 4); - fail_if(data == NULL); + fail_if(!data); result = eet_data_image_read_to_surface(ef, EET_TEST_FILE_IMAGE "0", 4, @@ -1375,7 +1375,7 @@ START_TEST(eet_image) free(data); data = malloc(w * h * 4); - fail_if(data == NULL); + fail_if(!data); result = eet_data_image_read_to_surface(ef, EET_TEST_FILE_IMAGE "0", 0, @@ -1404,7 +1404,7 @@ START_TEST(eet_image) &compress, &quality, &lossy); - fail_if(data == NULL); + fail_if(!data); fail_if(w != test_noalpha.w); fail_if(h != test_noalpha.h); fail_if(alpha != test_noalpha.alpha); @@ -1422,7 +1422,7 @@ START_TEST(eet_image) &compress, &quality, &lossy); - fail_if(data == NULL); + fail_if(!data); fail_if(w != test_noalpha.w); fail_if(h != test_noalpha.h); fail_if(alpha != test_noalpha.alpha); @@ -1439,7 +1439,7 @@ START_TEST(eet_image) &compress, &quality, &lossy); - fail_if(data == NULL); + fail_if(!data); fail_if(w != test_noalpha.w); fail_if(h != test_noalpha.h); fail_if(alpha != test_noalpha.alpha); @@ -1454,7 +1454,7 @@ START_TEST(eet_image) &compress, &quality, &lossy); - fail_if(data == NULL); + fail_if(!data); fail_if(w != test_noalpha.w); fail_if(h != test_noalpha.h); fail_if(alpha != test_noalpha.alpha); @@ -1469,7 +1469,7 @@ START_TEST(eet_image) &compress, &quality, &lossy); - fail_if(data == NULL); + fail_if(!data); fail_if(w != test_noalpha.w); fail_if(h != test_noalpha.h); fail_if(alpha != test_noalpha.alpha); @@ -1499,7 +1499,7 @@ START_TEST(eet_image) &compress, &quality, &lossy); - fail_if(data == NULL); + fail_if(!data); fail_if(w != test_alpha.w); fail_if(h != test_alpha.h); fail_if(alpha != test_alpha.alpha); @@ -1530,7 +1530,7 @@ START_TEST(eet_image) &compress, &quality, &lossy); - fail_if(data == NULL); + fail_if(!data); fail_if(w != test_alpha.w); fail_if(h != test_alpha.h); fail_if(alpha != test_alpha.alpha); @@ -1654,7 +1654,7 @@ START_TEST(eet_identity_simple) fail_if(memcmp(test, buffer, strlen(buffer) + 1) != 0); tmp = eet_identity_x509(ef, &size); - fail_if(tmp == NULL); + fail_if(!tmp); eet_identity_certificate_print(tmp, size, noread); @@ -1850,7 +1850,7 @@ open_close_worker(void * path) while (!open_worker_stop) { Eet_File * ef = eet_open((char const *)path, EET_FILE_MODE_READ); - if (ef == NULL) + if (!ef) pthread_exit("eet_open() failed"); else { @@ -1871,7 +1871,7 @@ open_close_worker(void * path) while (!open_worker_stop) { Eet_File * ef = eet_open((char const *)path, EET_FILE_MODE_READ); - if (ef == NULL) + if (!ef) _endthreadex(-1); else { @@ -1964,11 +1964,11 @@ _eet_connection_read(const void * eet_data, size_t size, void * user_data) fail_if(!node); fail_if(_eet_test_ex_check(result, 0) != 0); fail_if(_eet_test_ex_check(eina_list_data_get(result->list), 1) != 0); - fail_if(eina_list_data_get(result->ilist) == NULL); + fail_if(!eina_list_data_get(result->ilist)); fail_if(*((int *)eina_list_data_get(result->ilist)) != 42); - fail_if(eina_list_data_get(result->slist) == NULL); + fail_if(!eina_list_data_get(result->slist)); fail_if(strcmp(eina_list_data_get(result->slist), "test") != 0); - fail_if(eina_hash_find(result->shash, EET_TEST_KEY1) == NULL); + fail_if(!eina_hash_find(result->shash, EET_TEST_KEY1)); fail_if(strcmp(eina_hash_find(result->shash, EET_TEST_KEY1), "test") != 0); fail_if(strcmp(result->charray[0], "test") != 0); @@ -2329,7 +2329,7 @@ _eet_union_type_get(const void * data, Eina_Bool * unknow) if (unknow) *unknow = EINA_FALSE; - for (i = 0; eet_mapping[i].name != NULL; ++i) + for (i = 0; eet_mapping[i].name; ++i) if (*u == eet_mapping[i].u) return eet_mapping[i].name; @@ -2348,7 +2348,7 @@ _eet_union_type_set(const char * type, void * data, Eina_Bool unknow) if (unknow) return EINA_FALSE; - for (i = 0; eet_mapping[i].name != NULL; ++i) + for (i = 0; eet_mapping[i].name; ++i) if (strcmp(eet_mapping[i].name, type) == 0) { *u = eet_mapping[i].u; @@ -2367,7 +2367,7 @@ _eet_variant_type_get(const void * data, Eina_Bool * unknow) if (unknow) *unknow = type->unknow; - for (i = 0; eet_mapping[i].name != NULL; ++i) + for (i = 0; eet_mapping[i].name; ++i) if (strcmp(type->type, eet_mapping[i].name) == 0) return eet_mapping[i].name; diff --git a/legacy/efreet/src/lib/efreet_desktop_command.c b/legacy/efreet/src/lib/efreet_desktop_command.c index 9a563c5d80..461d934c92 100644 --- a/legacy/efreet/src/lib/efreet_desktop_command.c +++ b/legacy/efreet/src/lib/efreet_desktop_command.c @@ -489,7 +489,7 @@ efreet_desktop_command_build(Efreet_Desktop_Command *command) * fields (fFuUdDnN). We only want to run the app once in this case. */ if (!file_added) break; } - while ((l = eina_list_next(l)) != NULL); + while ((l = eina_list_next(l))); return execs; error: diff --git a/legacy/efreet/src/lib/efreet_icon.c b/legacy/efreet/src/lib/efreet_icon.c index 7157f3415e..4c33523f54 100644 --- a/legacy/efreet/src/lib/efreet_icon.c +++ b/legacy/efreet/src/lib/efreet_icon.c @@ -107,7 +107,7 @@ efreet_icon_init(void) } /* setup the default extension list */ - for (i = 0; default_exts[i] != NULL; i++) + for (i = 0; default_exts[i]; i++) efreet_icon_extensions = eina_list_append(efreet_icon_extensions, eina_stringshare_add(default_exts[i])); efreet_icon_themes = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_icon_theme_free)); @@ -659,7 +659,7 @@ efreet_icon_lookup_icon(Efreet_Icon_Theme *theme, const char *icon_name, double minimal_distance = INT_MAX; unsigned int ret_size = 0; - if (!theme || (theme->paths == NULL) || !icon_name || !size) + if (!theme || (!theme->paths) || !icon_name || !size) return NULL; icon = efreet_icon_cache_check(theme, icon_name, size); @@ -1317,7 +1317,7 @@ efreet_icon_theme_dir_scan(const char *search_dir, const char *theme_name) /* only care if this is a directory or the theme name matches the * given name */ snprintf(path, sizeof(path), "%s/%s", search_dir, dir->d_name); - if (((theme_name != NULL) && (strcmp(theme_name, dir->d_name))) + if (((theme_name) && (strcmp(theme_name, dir->d_name))) || !ecore_file_is_dir(path)) continue; diff --git a/legacy/efreet/src/lib/efreet_ini.c b/legacy/efreet/src/lib/efreet_ini.c index ecb9bd4c3d..c20f46de5e 100644 --- a/legacy/efreet/src/lib/efreet_ini.c +++ b/legacy/efreet/src/lib/efreet_ini.c @@ -183,7 +183,7 @@ efreet_ini_parse(const char *file) goto next_line; } - if (section == NULL) + if (!section) { // INF("Invalid file (%s) (missing section)", file); goto next_line; diff --git a/legacy/efreet/src/lib/efreet_menu.c b/legacy/efreet/src/lib/efreet_menu.c index e9c1566e2e..e5168e5a7f 100644 --- a/legacy/efreet/src/lib/efreet_menu.c +++ b/legacy/efreet/src/lib/efreet_menu.c @@ -490,7 +490,7 @@ efreet_menu_init(void) * to handle it */ efreet_tag_menu = eina_stringshare_add(menu_cbs[0].key); - for (i = 0; menu_cbs[i].key != NULL; i++) + for (i = 0; menu_cbs[i].key; i++) { eina_hash_del(efreet_menu_handle_cbs, menu_cbs[i].key, @@ -499,7 +499,7 @@ efreet_menu_init(void) menu_cbs[i].key, menu_cbs[i].cb); } - for (i = 0; filter_cbs[i].key != NULL; i++) + for (i = 0; filter_cbs[i].key; i++) { eina_hash_del(efreet_menu_filter_cbs, filter_cbs[i].key, @@ -508,7 +508,7 @@ efreet_menu_init(void) filter_cbs[i].key, filter_cbs[i].cb); } - for (i = 0; move_cbs[i].key != NULL; i++) + for (i = 0; move_cbs[i].key; i++) { eina_hash_del(efreet_menu_move_cbs, move_cbs[i].key, @@ -517,7 +517,7 @@ efreet_menu_init(void) move_cbs[i].key, move_cbs[i].cb); } - for (i = 0; layout_cbs[i].key != NULL; i++) + for (i = 0; layout_cbs[i].key; i++) { eina_hash_del(efreet_menu_layout_cbs, layout_cbs[i].key, diff --git a/legacy/efreet/src/tests/compare/efreet_alloc.c b/legacy/efreet/src/tests/compare/efreet_alloc.c index 98d11ae8f5..a6582e1399 100644 --- a/legacy/efreet/src/tests/compare/efreet_alloc.c +++ b/legacy/efreet/src/tests/compare/efreet_alloc.c @@ -13,7 +13,7 @@ main(void) for (k = 0; k < LOOPS; k++) { - for (i = 0; icons[i] != NULL; i++) + for (i = 0; icons[i]; i++) { path = efreet_icon_path_find(THEME, icons[i], SIZE); // printf("%s: %s\n", icons[i], (path ? path : "NOT FOUND")); diff --git a/legacy/efreet/src/tests/ef_data_dirs.c b/legacy/efreet/src/tests/ef_data_dirs.c index f5705fd659..d6c629b5ea 100644 --- a/legacy/efreet/src/tests/ef_data_dirs.c +++ b/legacy/efreet/src/tests/ef_data_dirs.c @@ -169,7 +169,7 @@ ef_cb_efreet_data_dirs(void) char *def_vals[] = {PACKAGE_DATA_DIR, "/usr/share", "/usr/local/share", NULL}; dirs[0] = '\0'; - for (i = 0; vals[i] != NULL; i++) + for (i = 0; vals[i]; i++) { if (i > 0) strcat(dirs, ":"); strcat(dirs, vals[i]); @@ -183,7 +183,7 @@ ef_cb_efreet_data_dirs(void) tmp = efreet_data_dirs_get(); EINA_LIST_FOREACH(tmp, l, val) { - if (vals[i] == NULL) + if (!vals[i]) { printf("efreet_data_dirs_get() returned more values then it " "should have given %s as input\n", dirs); @@ -215,7 +215,7 @@ ef_cb_efreet_data_dirs(void) EINA_LIST_FOREACH(tmp, l, val) { - if (def_vals[i] == NULL) + if (!def_vals[i]) { printf("efreet_data_dirs_get() returned more values then it " "should have given %s as input\n", dirs); @@ -246,7 +246,7 @@ ef_cb_efreet_config_dirs(void) dirs[0] = '\0'; - for (i = 0; vals[i] != NULL; i++) + for (i = 0; vals[i]; i++) { if (i > 0) strcat(dirs, ":"); strcat(dirs, vals[i]); @@ -260,7 +260,7 @@ ef_cb_efreet_config_dirs(void) tmp = efreet_config_dirs_get(); EINA_LIST_FOREACH(tmp, l, val) { - if (vals[i] == NULL) + if (!vals[i]) { printf("efreet_config_dirs_get() returned more values then it " "should have given %s as input\n", dirs); @@ -286,7 +286,7 @@ ef_cb_efreet_config_dirs(void) tmp = efreet_config_dirs_get(); EINA_LIST_FOREACH(tmp, l, val) { - if (def_vals[i] == NULL) + if (!def_vals[i]) { printf("efreet_config_dirs_get() returned more values then it " "should have given %s as input\n", dirs); diff --git a/legacy/efreet/src/tests/ef_icon_theme.c b/legacy/efreet/src/tests/ef_icon_theme.c index 3b5c70119f..bb66698885 100644 --- a/legacy/efreet/src/tests/ef_icon_theme.c +++ b/legacy/efreet/src/tests/ef_icon_theme.c @@ -478,7 +478,7 @@ ef_cb_efreet_icon_match(void) themes = eina_list_remove_list(themes, themes); double start = ecore_time_get(); - for (i = 0; system_icons[i] != NULL; i++) + for (i = 0; system_icons[i]; i++) { char *path, *s; @@ -516,7 +516,7 @@ ef_cb_efreet_icon_match(void) eina_hash_free(icon_hash); start = ecore_time_get(); - for (i = 0; system_icons[i] != NULL; i++) + for (i = 0; system_icons[i]; i++) { char *path, *s; diff --git a/legacy/efreet/src/tests/ef_locale.c b/legacy/efreet/src/tests/ef_locale.c index d71799ecde..cfc50e2626 100644 --- a/legacy/efreet/src/tests/ef_locale.c +++ b/legacy/efreet/src/tests/ef_locale.c @@ -44,7 +44,7 @@ ef_cb_locale(void) putenv("LC_MESSAGES="); putenv("LANG="); - for (i = 0; langs[i].lc_message != NULL; i++) + for (i = 0; langs[i].lc_message; i++) { const char *tmp; diff --git a/legacy/efreet/src/tests/ef_mime.c b/legacy/efreet/src/tests/ef_mime.c index 9c49eedfcc..89ace2b9e0 100644 --- a/legacy/efreet/src/tests/ef_mime.c +++ b/legacy/efreet/src/tests/ef_mime.c @@ -30,7 +30,7 @@ ef_mime_cb_get(void) return 1; } - for (i = 0; files[i].file != NULL; ++i) + for (i = 0; files[i].file; ++i) { mime = efreet_mime_type_get(files[i].file); if (!mime) diff --git a/legacy/efreet/src/tests/efreet_suite.c b/legacy/efreet/src/tests/efreet_suite.c index 801a41376a..7424435b5f 100644 --- a/legacy/efreet/src/tests/efreet_suite.c +++ b/legacy/efreet/src/tests/efreet_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); } @@ -55,7 +55,7 @@ efreet_suite_build(int argc, const char **argv) s = suite_create("Efreet"); - 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/legacy/efreet/src/tests/main.c b/legacy/efreet/src/tests/main.c index 3298e6b9db..147bf8cbff 100644 --- a/legacy/efreet/src/tests/main.c +++ b/legacy/efreet/src/tests/main.c @@ -124,7 +124,7 @@ main(int argc, char ** argv) if ((!strcmp(argv[i], "-h")) || (!strcmp(argv[i], "--help"))) { - for (i = 0; tests[i].name != NULL; i++) + for (i = 0; tests[i].name; i++) { printf("%s\n", tests[i].name); } @@ -135,7 +135,7 @@ main(int argc, char ** argv) } environment_store(); - for (i = 0; tests[i].name != NULL; i++) + for (i = 0; tests[i].name; i++) { int ret; double start; diff --git a/legacy/eina/src/include/eina_safety_checks.h b/legacy/eina/src/include/eina_safety_checks.h index 79ebc54fd3..29ebba07d3 100644 --- a/legacy/eina/src/include/eina_safety_checks.h +++ b/legacy/eina/src/include/eina_safety_checks.h @@ -196,10 +196,10 @@ EAPI extern Eina_Error EINA_ERROR_SAFETY_FAILED; #else /* no safety checks */ #define EINA_SAFETY_ON_NULL_RETURN(exp) \ - do { (void)((exp) == NULL); } while (0) + do { (void)(!(exp)); } while (0) #define EINA_SAFETY_ON_NULL_RETURN_VAL(exp, val) \ - do { if (0 && (exp) == NULL) { (void)val; } } while (0) + do { if (0 && !(exp)) { (void)val; } } while (0) #define EINA_SAFETY_ON_NULL_GOTO(exp, label) \ do { if (0 && (exp) == NULL) { goto label; } } while (0) diff --git a/legacy/eina/src/lib/eina_file.c b/legacy/eina/src/lib/eina_file.c index 0e3a3dfae7..8c75c4c21e 100644 --- a/legacy/eina/src/lib/eina_file.c +++ b/legacy/eina/src/lib/eina_file.c @@ -375,7 +375,7 @@ eina_file_split(char *path) return NULL; for (current = strchr(path, PATH_DELIM); - current != NULL; + current; path = current + 1, current = strchr(path, PATH_DELIM)) { length = current - path; diff --git a/legacy/eina/src/lib/eina_hash.c b/legacy/eina/src/lib/eina_hash.c index 076a4075d5..0d95e42a60 100644 --- a/legacy/eina/src/lib/eina_hash.c +++ b/legacy/eina/src/lib/eina_hash.c @@ -603,7 +603,7 @@ _eina_hash_iterator_next(Eina_Iterator_Hash *it, void **data) if (!(it->index < it->hash->population)) return EINA_FALSE; - if (it->current == NULL) + if (!it->current) { ok = EINA_FALSE; bucket = 0; @@ -638,7 +638,7 @@ _eina_hash_iterator_next(Eina_Iterator_Hash *it, void **data) { while (bucket < it->hash->size) { - if (it->hash->buckets[bucket] != NULL) + if (it->hash->buckets[bucket]) { it->current = eina_rbtree_iterator_prefix(it->hash->buckets[bucket]); diff --git a/legacy/eina/src/lib/eina_inlist.c b/legacy/eina/src/lib/eina_inlist.c index 82873b763e..c7403a37c5 100644 --- a/legacy/eina/src/lib/eina_inlist.c +++ b/legacy/eina/src/lib/eina_inlist.c @@ -63,7 +63,7 @@ struct _Eina_Accessor_Inlist static Eina_Bool eina_inlist_iterator_next(Eina_Iterator_Inlist *it, void **data) { - if (it->current == NULL) + if (!it->current) return EINA_FALSE; if (data) @@ -97,7 +97,7 @@ eina_inlist_accessor_get_at(Eina_Accessor_Inlist *it, else if (idx > it->index) /* Looking after current. */ for (i = it->index, over = it->current; - i < idx && over != NULL; + i < idx && over; ++i, over = over->next) ; else @@ -107,18 +107,18 @@ eina_inlist_accessor_get_at(Eina_Accessor_Inlist *it, if (idx > middle) /* Looking backward from current. */ for (i = it->index, over = it->current; - i > idx && over != NULL; + i > idx && over; --i, over = over->prev) ; else /* Looking from the start. */ for (i = 0, over = it->head; - i < idx && over != NULL; + i < idx && over; ++i, over = over->next) ; } - if (over == NULL) + if (!over) return EINA_FALSE; it->current = over; @@ -437,7 +437,7 @@ eina_inlist_remove(Eina_Inlist *list, Eina_Inlist *item) EINA_SAFETY_ON_NULL_RETURN_VAL(list, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(item, list); EINA_SAFETY_ON_TRUE_RETURN_VAL - ((item != list) && (item->prev == NULL) && (item->next == NULL), list); + ((item != list) && (!item->prev) && (!item->next), list); if (item->next) item->next->prev = item->prev; diff --git a/legacy/eina/src/lib/eina_list.c b/legacy/eina/src/lib/eina_list.c index 2b140d23b3..1b05e4f05d 100644 --- a/legacy/eina/src/lib/eina_list.c +++ b/legacy/eina/src/lib/eina_list.c @@ -272,7 +272,7 @@ eina_list_iterator_next(Eina_Iterator_List *it, void **data) { EINA_MAGIC_CHECK_LIST_ITERATOR(it, EINA_FALSE); - if (it->current == NULL) + if (!it->current) return EINA_FALSE; *data = eina_list_data_get(it->current); @@ -287,7 +287,7 @@ eina_list_iterator_prev(Eina_Iterator_List *it, void **data) { EINA_MAGIC_CHECK_LIST_ITERATOR(it, EINA_FALSE); - if (it->current == NULL) + if (!it->current) return EINA_FALSE; *data = eina_list_data_get(it->current); @@ -336,13 +336,13 @@ eina_list_accessor_get_at(Eina_Accessor_List *it, unsigned int idx, void **data) /* Go backward from the end. */ for (i = eina_list_count(it->head) - 1, over = eina_list_last(it->head); - i > idx && over != NULL; + i > idx && over; --i, over = eina_list_prev(over)) ; else /* Go forward from current. */ for (i = it->index, over = it->current; - i < idx && over != NULL; + i < idx && over; ++i, over = eina_list_next(over)) ; } @@ -354,18 +354,18 @@ eina_list_accessor_get_at(Eina_Accessor_List *it, unsigned int idx, void **data) if (idx > middle) /* Go backward from current. */ for (i = it->index, over = it->current; - i > idx && over != NULL; + i > idx && over; --i, over = eina_list_prev(over)) ; else /* Go forward from start. */ for (i = 0, over = it->head; - i < idx && over != NULL; + i < idx && over; ++i, over = eina_list_next(over)) ; } - if (over == NULL) + if (!over) return EINA_FALSE; it->current = over; diff --git a/legacy/eina/src/lib/eina_log.c b/legacy/eina/src/lib/eina_log.c index f8af3b9aa7..97d652bc6c 100644 --- a/legacy/eina/src/lib/eina_log.c +++ b/legacy/eina/src/lib/eina_log.c @@ -2373,19 +2373,19 @@ eina_log_print(int domain, Eina_Log_Level level, const char *file, va_list args; #ifdef EINA_SAFETY_CHECKS - if (EINA_UNLIKELY(file == NULL)) + if (EINA_UNLIKELY(!file)) { fputs("ERR: eina_log_print() file == NULL\n", stderr); return; } - if (EINA_UNLIKELY(fnc == NULL)) + if (EINA_UNLIKELY(!fnc)) { fputs("ERR: eina_log_print() fnc == NULL\n", stderr); return; } - if (EINA_UNLIKELY(fmt == NULL)) + if (EINA_UNLIKELY(!fmt)) { fputs("ERR: eina_log_print() fmt == NULL\n", stderr); return; @@ -2428,19 +2428,19 @@ eina_log_vprint(int domain, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, va_list args) { #ifdef EINA_SAFETY_CHECKS - if (EINA_UNLIKELY(file == NULL)) + if (EINA_UNLIKELY(!file)) { fputs("ERR: eina_log_print() file == NULL\n", stderr); return; } - if (EINA_UNLIKELY(fnc == NULL)) + if (EINA_UNLIKELY(!fnc)) { fputs("ERR: eina_log_print() fnc == NULL\n", stderr); return; } - if (EINA_UNLIKELY(fmt == NULL)) + if (EINA_UNLIKELY(!fmt)) { fputs("ERR: eina_log_print() fmt == NULL\n", stderr); return; diff --git a/legacy/eina/src/lib/eina_matrixsparse.c b/legacy/eina/src/lib/eina_matrixsparse.c index 4857a5358a..a12c74aab8 100644 --- a/legacy/eina/src/lib/eina_matrixsparse.c +++ b/legacy/eina/src/lib/eina_matrixsparse.c @@ -429,7 +429,7 @@ _eina_matrixsparse_row_idx_get(const Eina_Matrixsparse *m, unsigned long row) assert(dir != 0); if (dir > 0) { - for (; r != NULL; r = r->next) + for (; r; r = r->next) if (r->row == row) { ((Eina_Matrixsparse *)m)->last_used = r; @@ -440,7 +440,7 @@ _eina_matrixsparse_row_idx_get(const Eina_Matrixsparse *m, unsigned long row) } else if (dir < 0) - for (; r != NULL; r = r->prev) + for (; r; r = r->prev) if (r->row == row) { ((Eina_Matrixsparse *)m)->last_used = r; @@ -479,7 +479,7 @@ _eina_matrixsparse_row_cell_idx_get(const Eina_Matrixsparse_Row *r, assert(dir != 0); if (dir > 0) { - for (; r != NULL; c = c->next) + for (; r; c = c->next) if (c->col == col) { ((Eina_Matrixsparse_Row *)r)->last_used = c; @@ -490,7 +490,7 @@ _eina_matrixsparse_row_cell_idx_get(const Eina_Matrixsparse_Row *r, } else if (dir < 0) - for (; r != NULL; c = c->prev) + for (; r; c = c->prev) if (c->col == col) { ((Eina_Matrixsparse_Row *)r)->last_used = c; @@ -527,21 +527,21 @@ _eina_matrixsparse_row_idx_siblings_find(const Eina_Matrixsparse *m, assert(dir != 0); if (dir > 0) { - for (; r != NULL; r = r->next) + for (; r; r = r->next) if (r->row > row) break; - assert(r != NULL); + assert(!!r); *p_prev = r->prev; *p_next = r; } else if (dir < 0) { - for (; r != NULL; r = r->prev) + for (; r; r = r->prev) if (r->row < row) break; - assert(r != NULL); + assert(!!r); *p_prev = r; *p_next = r->next; } @@ -560,21 +560,21 @@ _eina_matrixsparse_row_cell_idx_siblings_find(const Eina_Matrixsparse_Row *r, assert(dir != 0); if (dir > 0) { - for (; c != NULL; c = c->next) + for (; c; c = c->next) if (c->col > col) break; - assert(c != NULL); + assert(!!c); *p_prev = c->prev; *p_next = c; } else if (dir < 0) { - for (; c != NULL; c = c->prev) + for (; c; c = c->prev) if (c->col < col) break; - assert(c != NULL); + assert(!!c); *p_prev = c; *p_next = c->next; } @@ -613,8 +613,8 @@ _eina_matrixsparse_row_idx_add(Eina_Matrixsparse *m, unsigned long row) { Eina_Matrixsparse_Row *prev = NULL, *next = NULL; _eina_matrixsparse_row_idx_siblings_find(m, row, &prev, &next); - assert(prev != NULL); - assert(next != NULL); + assert(!!prev); + assert(!!next); r->prev = prev; r->next = next; prev->next = r; @@ -666,8 +666,8 @@ _eina_matrixsparse_row_cell_idx_add(Eina_Matrixsparse_Row *r, { Eina_Matrixsparse_Cell *prev = NULL, *next = NULL; _eina_matrixsparse_row_cell_idx_siblings_find(r, col, &prev, &next); - assert(prev != NULL); - assert(next != NULL); + assert(!!prev); + assert(!!next); c->prev = prev; c->next = next; prev->next = c; @@ -758,7 +758,7 @@ _eina_matrixsparse_iterator_complete_next( if (it->idx.row >= it->m->size.rows) return 0; - if (it->dummy.col.data != NULL) + if (it->dummy.col.data) ERR("Last iterator call changed dummy cell!"); if ((it->ref.col) && @@ -806,7 +806,7 @@ _eina_matrixsparse_iterator_complete_free( { EINA_MAGIC_CHECK_MATRIXSPARSE_ITERATOR(it); - if (it->dummy.col.data != NULL) + if (it->dummy.col.data) ERR("Last iterator call changed dummy cell!"); EINA_MAGIC_SET(it, EINA_MAGIC_NONE); @@ -1478,7 +1478,7 @@ eina_matrixsparse_column_idx_clear(Eina_Matrixsparse *m, unsigned long col) free_func = m->free.func; user_data = m->free.user_data; - for (r = m->rows; r != NULL; ) + for (r = m->rows; r; ) { Eina_Matrixsparse_Row *r_aux = r; Eina_Matrixsparse_Cell *c; diff --git a/legacy/eina/src/lib/eina_rbtree.c b/legacy/eina/src/lib/eina_rbtree.c index 6d4130bab9..7e69d2c4b7 100644 --- a/legacy/eina/src/lib/eina_rbtree.c +++ b/legacy/eina/src/lib/eina_rbtree.c @@ -116,11 +116,11 @@ _eina_rbtree_iterator_next(Eina_Iterator_Rbtree *it, void **data) last = eina_array_data_get(it->stack, eina_array_count_get(it->stack) - 1); tree = last->tree; - if (last->tree == NULL || last->up == EINA_TRUE) + if (!last->tree || last->up == EINA_TRUE) { last = eina_array_pop(it->stack); while (last->dir == EINA_RBTREE_LEFT - || last->tree == NULL) + || !last->tree) { if (tree) if ((it->mask & EINA_RBTREE_ITERATOR_POSTFIX_MASK) == @@ -242,7 +242,7 @@ _eina_rbtree_node_init(Eina_Rbtree *node) static inline Eina_Bool _eina_rbtree_is_red(Eina_Rbtree *node) { - return node != NULL && node->color == EINA_RBTREE_RED; + return !!node && node->color == EINA_RBTREE_RED; } static inline Eina_Rbtree * @@ -317,7 +317,7 @@ eina_rbtree_inline_insert(Eina_Rbtree *root, /* Search down the tree */ for (;; ) { - if (q == NULL) + if (!q) /* Insert new node at the bottom */ p->son[dir] = q = node; else if (_eina_rbtree_is_red(q->son[0]) @@ -350,7 +350,7 @@ eina_rbtree_inline_insert(Eina_Rbtree *root, dir = cmp(q, node, (void *)data); /* Update helpers */ - if ( g != NULL ) + if ( g ) t = g; g = p, p = q; @@ -391,7 +391,7 @@ eina_rbtree_inline_remove(Eina_Rbtree *root, q->son[EINA_RBTREE_RIGHT] = root; /* Search and push a red down */ - while (q->son[dir] != NULL) + while (q->son[dir]) { Eina_Rbtree_Direction last = dir; Eina_Rbtree *g; @@ -415,7 +415,7 @@ eina_rbtree_inline_remove(Eina_Rbtree *root, { Eina_Rbtree *s = p->son[!last]; - if (s != NULL) + if (s) { if (!_eina_rbtree_is_red(s->son[EINA_RBTREE_LEFT]) && !_eina_rbtree_is_red(s->son[EINA_RBTREE_RIGHT])) @@ -466,13 +466,13 @@ eina_rbtree_inline_remove(Eina_Rbtree *root, } /* Replace and remove if found */ - if (f != NULL) + if (f) { /* 'q' should take the place of 'node' parent */ f->son[f->son[1] == node] = q; /* Switch the link from the parent to q's son */ - p->son[p->son[1] == q] = q->son[q->son[0] == NULL]; + p->son[p->son[1] == q] = q->son[!q->son[0]]; /* Put q at the place of node */ q->son[0] = node->son[0]; @@ -485,7 +485,7 @@ eina_rbtree_inline_remove(Eina_Rbtree *root, } root = head.son[1]; - if (root != NULL) + if (root) root->color = EINA_RBTREE_BLACK; return root; diff --git a/legacy/eina/src/lib/eina_share_common.c b/legacy/eina/src/lib/eina_share_common.c index 876b1ee85e..dcc99c2810 100644 --- a/legacy/eina/src/lib/eina_share_common.c +++ b/legacy/eina/src/lib/eina_share_common.c @@ -492,7 +492,7 @@ _eina_share_common_head_find(Eina_Share_Common_Head *head, prev = node; node = node->next; - for (; node != NULL; prev = node, node = node->next) + for (; node; prev = node, node = node->next) if (_eina_share_common_node_eq(node, str, slen)) { /* promote node, make hot items be at the beginning */ @@ -519,7 +519,7 @@ _eina_share_common_head_remove_node(Eina_Share_Common_Head *head, prev = head->head; cur = head->head->next; - for (; cur != NULL; prev = cur, cur = cur->next) + for (; cur; prev = cur, cur = cur->next) if (cur == node) { prev->next = cur->next; diff --git a/legacy/eina/src/lib/eina_tiler.c b/legacy/eina/src/lib/eina_tiler.c index 9d3f4cbc65..2d263b7a15 100644 --- a/legacy/eina/src/lib/eina_tiler.c +++ b/legacy/eina/src/lib/eina_tiler.c @@ -920,7 +920,7 @@ static void rect_list_merge_rects(list_t *rects, merged = 0; parent_node = NULL; node = rects->head; - while (node != NULL) + while (node) { rect_t r2, outer; int area; @@ -1067,7 +1067,7 @@ static Eina_Bool _iterator_next(Eina_Iterator_Tiler *it, void **data) Eina_Rectangle *rect = (Eina_Rectangle *)data; list_node_t *n; - for (n = it->curr; n != NULL; n = n->next) + for (n = it->curr; n; n = n->next) { rect_t cur; diff --git a/legacy/eina/src/tests/ecore_list.c b/legacy/eina/src/tests/ecore_list.c index f6ac49c611..7da44178b0 100644 --- a/legacy/eina/src/tests/ecore_list.c +++ b/legacy/eina/src/tests/ecore_list.c @@ -240,7 +240,7 @@ _ecore_list_append_0(Ecore_List *list, Ecore_List_Node *end) list->last = end; - if (list->first == NULL) + if (!list->first) { list->first = end; list->index = 0; @@ -288,7 +288,7 @@ _ecore_list_prepend_0(Ecore_List *list, Ecore_List_Node *start) list->first = start; /* If no last node, then the first node is the last node */ - if (list->last == NULL) + if (!list->last) list->last = list->first; list->nodes++; @@ -331,7 +331,7 @@ _ecore_list_insert(Ecore_List *list, Ecore_List_Node *new_node) if (list->current == list->first) return _ecore_list_prepend_0(list, new_node); - if (list->current == NULL) + if (!list->current) { int ret_value; @@ -942,7 +942,7 @@ _ecore_list_for_each(Ecore_List *list, Ecore_For_Each function, void *user_data) return FALSE; _ecore_list_first_goto(list); - while ((value = _ecore_list_next(list)) != NULL) + while ((value = _ecore_list_next(list))) function(value, user_data); return TRUE; @@ -976,7 +976,7 @@ _ecore_list_find(Ecore_List *list, return NULL; _ecore_list_first_goto(list); - while ((value = _ecore_list_current(list)) != NULL) + while ((value = _ecore_list_current(list))) { if (!function(value, user_data)) return value; diff --git a/legacy/eina/src/tests/eina_bench.c b/legacy/eina/src/tests/eina_bench.c index e971873961..501532703c 100644 --- a/legacy/eina/src/tests/eina_bench.c +++ b/legacy/eina/src/tests/eina_bench.c @@ -83,7 +83,7 @@ main(int argc, char **argv) eina_init(); - for (i = 0; etc[i].bench_case != NULL; ++i) + for (i = 0; etc[i].bench_case; ++i) { test = eina_benchmark_new(etc[i].bench_case, argv[1]); if (!test) diff --git a/legacy/eina/src/tests/eina_suite.c b/legacy/eina/src/tests/eina_suite.c index 78a014f950..15d8ff8c4b 100644 --- a/legacy/eina/src/tests/eina_suite.c +++ b/legacy/eina/src/tests/eina_suite.c @@ -70,7 +70,7 @@ _list_tests(void) { const Eina_Test_Case *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); } @@ -96,7 +96,7 @@ eina_build_suite(int argc, const char **argv) s = suite_create("Eina"); - 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; diff --git a/legacy/eina/src/tests/eina_test_binshare.c b/legacy/eina/src/tests/eina_test_binshare.c index b6c4c79396..8dab062e79 100644 --- a/legacy/eina/src/tests/eina_test_binshare.c +++ b/legacy/eina/src/tests/eina_test_binshare.c @@ -85,8 +85,8 @@ START_TEST(eina_binshare_small) t0 = eina_binshare_add_length(buf, i); t1 = eina_binshare_add_length(buf, i); - fail_if(t0 == NULL); - fail_if(t1 == NULL); + fail_if(!t0); + fail_if(!t1); fail_if(t0 != t1); fail_if(memcmp(t0, buf, i) != 0); @@ -110,8 +110,8 @@ START_TEST(eina_binshare_test_share) t0 = eina_binshare_add_length(TEST0, TEST0_SIZE); t1 = eina_binshare_add_length(TEST0, TEST0_SIZE); - fail_if(t0 == NULL); - fail_if(t1 == NULL); + fail_if(!t0); + fail_if(!t1); fail_if(memcmp(t0, TEST0, TEST0_SIZE) != 0); fail_if(memcmp(t1, TEST0, TEST0_SIZE) != 0); fail_if(t0 != t1); @@ -168,7 +168,7 @@ START_TEST(eina_binshare_collision) if (rand() > RAND_MAX / 2) { const char *r = eina_binshare_add_length(buffer, strlen(buffer)); - fail_if(r == NULL); + fail_if(!r); } } @@ -180,9 +180,9 @@ START_TEST(eina_binshare_collision) eina_array_push(ea, (void *)eina_binshare_add_length(buffer, strlen(buffer))); r = eina_binshare_add_length(buffer, strlen(buffer)); - fail_if(r == NULL); + fail_if(!r); r = eina_binshare_add_length(buffer, strlen(buffer)); - fail_if(r == NULL); + fail_if(!r); } for (i = 0; i < 200; ++i) diff --git a/legacy/eina/src/tests/eina_test_hash.c b/legacy/eina/src/tests/eina_test_hash.c index aeeb655e7b..ac6ee76c6c 100644 --- a/legacy/eina/src/tests/eina_test_hash.c +++ b/legacy/eina/src/tests/eina_test_hash.c @@ -111,7 +111,7 @@ START_TEST(eina_hash_extended) fail_if(eina_init() != 2); hash = eina_hash_string_djb2_new(NULL); - fail_if(hash == NULL); + fail_if(!hash); fail_if(eina_hash_direct_add(hash, "42", "42") != EINA_TRUE); @@ -123,7 +123,7 @@ START_TEST(eina_hash_extended) fail_if(eina_hash_direct_add(hash, tmp, tmp) != EINA_TRUE); } - fail_if(eina_hash_find(hash, "42") == NULL); + fail_if(!eina_hash_find(hash, "42")); eina_hash_free(hash); @@ -140,7 +140,7 @@ START_TEST(eina_hash_double_item) fail_if(eina_init() != 2); hash = eina_hash_string_superfast_new(NULL); - fail_if(hash == NULL); + fail_if(!hash); fail_if(eina_hash_add(hash, "7", &i[0]) != EINA_TRUE); fail_if(eina_hash_add(hash, "7", &i[1]) != EINA_TRUE); @@ -167,7 +167,7 @@ START_TEST(eina_hash_all_int) fail_if(eina_init() != 2); hash = eina_hash_int32_new(NULL); - fail_if(hash == NULL); + fail_if(!hash); for (it = 0; it < 4; ++it) fail_if(eina_hash_add(hash, &i[it], &i[it]) != EINA_TRUE); @@ -182,7 +182,7 @@ START_TEST(eina_hash_all_int) eina_hash_free(hash); hash = eina_hash_int64_new(NULL); - fail_if(hash == NULL); + fail_if(!hash); for (it = 0; it < 4; ++it) fail_if(eina_hash_add(hash, &j[it], &j[it]) != EINA_TRUE); diff --git a/legacy/eina/src/tests/eina_test_list.c b/legacy/eina/src/tests/eina_test_list.c index 6e088473d1..eef1965490 100644 --- a/legacy/eina/src/tests/eina_test_list.c +++ b/legacy/eina/src/tests/eina_test_list.c @@ -220,39 +220,39 @@ START_TEST(eina_test_merge) l1 = eina_list_append(l1, &data[1]); l1 = eina_list_append(l1, &data[2]); l1 = eina_list_append(l1, &data[3]); - fail_if(l1 == NULL); + fail_if(!l1); l2 = eina_list_append(NULL, &data[4]); l2 = eina_list_append(l2, &data[5]); - fail_if(l2 == NULL); + fail_if(!l2); l1 = eina_list_merge(l1, l2); - fail_if(l1 == NULL); + fail_if(!l1); fail_if(eina_list_count(l1) != 6); - for (i = 0, l2 = l1; ((l2 != NULL) && (i < 6)); ++i, l2 = l2->next) + for (i = 0, l2 = l1; ((l2) && (i < 6)); ++i, l2 = l2->next) fail_if(l2->data != &data[i]); fail_if(i != 6); - fail_if(l2 != NULL); + fail_if(!!l2); eina_list_free(l1); l1 = eina_list_append(NULL, &data[0]); l1 = eina_list_append(l1, &data[1]); - fail_if(l1 == NULL); + fail_if(!l1); l2 = eina_list_append(NULL, &data[2]); l2 = eina_list_append(l2, &data[3]); l2 = eina_list_append(l2, &data[4]); l2 = eina_list_append(l2, &data[5]); - fail_if(l2 == NULL); + fail_if(!l2); l1 = eina_list_merge(l1, l2); - fail_if(l1 == NULL); + fail_if(!l1); fail_if(eina_list_count(l1) != 6); - for (i = 0, l2 = l1; ((l2 != NULL) && (i < 6)); ++i, l2 = l2->next) + for (i = 0, l2 = l1; ((l2) && (i < 6)); ++i, l2 = l2->next) fail_if(l2->data != &data[i]); fail_if(i != 6); - fail_if(l2 != NULL); + fail_if(!!l2); l3 = eina_list_append(NULL, &data[6]); l3 = eina_list_append(l3, &data[7]); @@ -272,15 +272,15 @@ START_TEST(eina_test_merge) l5 = eina_list_sort(l5, -1, eina_int_cmp); l1 = eina_list_sorted_merge(l1, l3, eina_int_cmp); - fail_if(l1 == NULL); + fail_if(!l1); fail_if(eina_list_count(l1) != 9); l1 = eina_list_sorted_merge(l1, l4, eina_int_cmp); - fail_if(l1 == NULL); + fail_if(!l1); fail_if(eina_list_count(l1) != 12); l1 = eina_list_sorted_merge(l1, l5, eina_int_cmp); - fail_if(l1 == NULL); + fail_if(!l1); fail_if(eina_list_count(l1) != 15); fail_if(!eina_list_sorted_check(l1)); @@ -305,14 +305,14 @@ START_TEST(eina_test_sorted_insert) for (i = 0; i < count; i++) l1 = eina_list_sorted_insert(l1, eina_int_cmp, data + i); - fail_if(l1 == NULL); + fail_if(!l1); fail_if(!eina_list_sorted_check(l1)); l2 = NULL; EINA_LIST_FOREACH(l1, itr, d) l2 = eina_list_sorted_insert(l2, eina_int_cmp, d); - fail_if(l2 == NULL); + fail_if(!l2); fail_if(!eina_list_sorted_check(l2)); eina_list_free(l2); @@ -320,7 +320,7 @@ START_TEST(eina_test_sorted_insert) EINA_LIST_REVERSE_FOREACH(l1, itr, d) l2 = eina_list_sorted_insert(l2, eina_int_cmp, d); - fail_if(l2 == NULL); + fail_if(!l2); fail_if(!eina_list_sorted_check(l2)); eina_list_free(l2); eina_list_free(l1); @@ -330,7 +330,7 @@ START_TEST(eina_test_sorted_insert) for (i = 0; i < count; i++) l1 = eina_list_sorted_insert(l1, eina_int_cmp, data2 + i); - fail_if(l1 == NULL); + fail_if(!l1); fail_if(!eina_list_sorted_check(l1)); eina_list_free(l1); diff --git a/legacy/eina/src/tests/eina_test_matrixsparse.c b/legacy/eina/src/tests/eina_test_matrixsparse.c index e07b1eead7..3f529a8e96 100644 --- a/legacy/eina/src/tests/eina_test_matrixsparse.c +++ b/legacy/eina/src/tests/eina_test_matrixsparse.c @@ -286,7 +286,7 @@ START_TEST(eina_test_resize) matrix = eina_matrixsparse_new(MAX_ROWS, MAX_COLS, eina_matrixsparse_free_cell_cb, data); - fail_if(matrix == NULL); + fail_if(!matrix); /* cell insertion */ data[0][5] = 5; @@ -408,7 +408,7 @@ START_TEST(eina_test_iterators) matrix = eina_matrixsparse_new(MAX_ROWS, MAX_COLS, eina_matrixsparse_free_cell_cb, data); - fail_if(matrix == NULL); + fail_if(!matrix); r = eina_matrixsparse_data_idx_set(matrix, 3, 5, &data[3][5]); fail_if(r == EINA_FALSE); @@ -448,23 +448,23 @@ START_TEST(eina_test_iterators) fail_if(r == EINA_FALSE); it = eina_matrixsparse_iterator_new(matrix); - fail_if(it == NULL); + fail_if(!it); EINA_ITERATOR_FOREACH(it, cell) { - fail_if(cell == NULL); + fail_if(!cell); r = eina_matrixsparse_cell_position_get(cell, &row, &col); fail_if(r == EINA_FALSE); test1 = eina_matrixsparse_cell_data_get(cell); - fail_if(test1 == NULL || *test1 != data[row][col]); + fail_if(!test1 || *test1 != data[row][col]); } eina_iterator_free(it); it = eina_matrixsparse_iterator_complete_new(matrix); - fail_if(it == NULL); + fail_if(!it); EINA_ITERATOR_FOREACH(it, cell) { - fail_if(cell == NULL); + fail_if(!cell); r = eina_matrixsparse_cell_position_get(cell, &row, &col); fail_if(r == EINA_FALSE); diff --git a/legacy/eina/src/tests/eina_test_mempool.c b/legacy/eina/src/tests/eina_test_mempool.c index f911fff7c3..a17d06d6bb 100644 --- a/legacy/eina/src/tests/eina_test_mempool.c +++ b/legacy/eina/src/tests/eina_test_mempool.c @@ -68,9 +68,9 @@ _eina_mempool_test(Eina_Mempool *mp, Eina_Bool with_realloc, Eina_Bool with_gc) eina_mempool_free(mp, tbl[i]); if (with_realloc) - fail_if(eina_mempool_realloc(mp, tbl[500], 25) == NULL); + fail_if(!eina_mempool_realloc(mp, tbl[500], 25)); else - fail_if(eina_mempool_realloc(mp, tbl[500], 25) != NULL); + fail_if(!!eina_mempool_realloc(mp, tbl[500], 25)); if (with_gc) { diff --git a/legacy/eina/src/tests/eina_test_rbtree.c b/legacy/eina/src/tests/eina_test_rbtree.c index fabe2bfd2a..cb8b85d993 100644 --- a/legacy/eina/src/tests/eina_test_rbtree.c +++ b/legacy/eina/src/tests/eina_test_rbtree.c @@ -30,7 +30,7 @@ static inline Eina_Bool _eina_rbtree_is_red(Eina_Rbtree *tree) { - return tree != NULL && tree->color == EINA_RBTREE_RED; + return !!tree && tree->color == EINA_RBTREE_RED; } static int @@ -261,7 +261,7 @@ START_TEST(eina_rbtree_simple_remove) _eina_rbtree_black_height(root, EINA_RBTREE_CMP_NODE_CB(eina_rbtree_int_cmp)); - fail_if(root == NULL); + fail_if(!root); i = 69; lookup = eina_rbtree_inline_lookup(root, @@ -271,7 +271,7 @@ START_TEST(eina_rbtree_simple_remove) eina_rbtree_int_key), NULL); _eina_rbtree_black_height(root, EINA_RBTREE_CMP_NODE_CB(eina_rbtree_int_cmp)); - fail_if(lookup == NULL); + fail_if(!lookup); root = eina_rbtree_inline_remove(root, lookup, EINA_RBTREE_CMP_NODE_CB( @@ -325,7 +325,7 @@ START_TEST(eina_rbtree_simple_remove2) _eina_rbtree_black_height(root, EINA_RBTREE_CMP_NODE_CB(eina_rbtree_int_cmp)); - fail_if(root == NULL); + fail_if(!root); i = 69; lookup = eina_rbtree_inline_lookup(root, @@ -335,7 +335,7 @@ START_TEST(eina_rbtree_simple_remove2) eina_rbtree_int_key), NULL); _eina_rbtree_black_height(root, EINA_RBTREE_CMP_NODE_CB(eina_rbtree_int_cmp)); - fail_if(lookup == NULL); + fail_if(!lookup); root = eina_rbtree_inline_remove(root, lookup, EINA_RBTREE_CMP_NODE_CB( @@ -419,7 +419,7 @@ START_TEST(eina_rbtree_simple_remove3) _eina_rbtree_black_height(root, EINA_RBTREE_CMP_NODE_CB(eina_rbtree_int_cmp)); - fail_if(root == NULL); + fail_if(!root); i = 1113497590; lookup = eina_rbtree_inline_lookup(root, @@ -429,7 +429,7 @@ START_TEST(eina_rbtree_simple_remove3) eina_rbtree_int_key), NULL); _eina_rbtree_black_height(root, EINA_RBTREE_CMP_NODE_CB(eina_rbtree_int_cmp)); - fail_if(lookup == NULL); + fail_if(!lookup); root = eina_rbtree_inline_remove(root, lookup, EINA_RBTREE_CMP_NODE_CB( diff --git a/legacy/eina/src/tests/eina_test_str.c b/legacy/eina/src/tests/eina_test_str.c index f0ea291731..fc34fd92ad 100644 --- a/legacy/eina/src/tests/eina_test_str.c +++ b/legacy/eina/src/tests/eina_test_str.c @@ -91,25 +91,25 @@ START_TEST(str_split) eina_init(); result = eina_str_split_full("nomatch", "", -1, &elements); - fail_if(result != NULL); + fail_if(!!result); fail_if(elements != 0); result = eina_str_split_full("nomatch", "x", -1, &elements); - fail_if(result == NULL); + fail_if(!result); fail_if(elements != 1); fail_if(strcmp(result[0], "nomatch") != 0); free(result[0]); free(result); result = eina_str_split_full("nomatch", "xyz", -1, &elements); - fail_if(result == NULL); + fail_if(!result); fail_if(elements != 1); fail_if(strcmp(result[0], "nomatch") != 0); free(result[0]); free(result); result = eina_str_split_full("match:match:match", ":", -1, &elements); - fail_if(result == NULL); + fail_if(!result); fail_if(elements != 3); while (elements >= 1) { @@ -120,7 +120,7 @@ START_TEST(str_split) free(result); result = eina_str_split_full("a:b:c", ":", -1, &elements); - fail_if(result == NULL); + fail_if(!result); fail_if(elements != 3); fail_if(strcmp(result[0], "a") != 0); fail_if(strcmp(result[1], "b") != 0); @@ -129,7 +129,7 @@ START_TEST(str_split) free(result); result = eina_str_split_full("a:b:", ":", -1, &elements); - fail_if(result == NULL); + fail_if(!result); fail_if(elements != 3); fail_if(strcmp(result[0], "a") != 0); fail_if(strcmp(result[1], "b") != 0); @@ -138,7 +138,7 @@ START_TEST(str_split) free(result); result = eina_str_split_full(":b:c", ":", -1, &elements); - fail_if(result == NULL); + fail_if(!result); fail_if(elements != 3); fail_if(strcmp(result[0], "") != 0); fail_if(strcmp(result[1], "b") != 0); @@ -147,7 +147,7 @@ START_TEST(str_split) free(result); result = eina_str_split_full(":", ":", -1, &elements); - fail_if(result == NULL); + fail_if(!result); fail_if(elements != 2); fail_if(strcmp(result[0], "") != 0); fail_if(strcmp(result[1], "") != 0); @@ -155,14 +155,14 @@ START_TEST(str_split) free(result); result = eina_str_split_full("a", "!!!!!!!!!", -1, &elements); - fail_if(result == NULL); + fail_if(!result); fail_if(elements != 1); fail_if(strcmp(result[0], "a") != 0); free(result[0]); free(result); result = eina_str_split_full("aaba", "ab", -1, &elements); - fail_if(result == NULL); + fail_if(!result); fail_if(elements != 2); fail_if(strcmp(result[0], "a") != 0); fail_if(strcmp(result[1], "a") != 0); diff --git a/legacy/eina/src/tests/eina_test_strbuf.c b/legacy/eina/src/tests/eina_test_strbuf.c index 87dfc56bf8..dc66dc5fee 100644 --- a/legacy/eina/src/tests/eina_test_strbuf.c +++ b/legacy/eina/src/tests/eina_test_strbuf.c @@ -350,7 +350,7 @@ START_TEST(strbuf_append_realloc) fail_if(eina_strbuf_length_get(buf) != (runs * target_pattern_size)); str = eina_strbuf_string_get(buf); - fail_if(str == NULL); + fail_if(!str); for (i = 0; i < runs; i++, str += target_pattern_size) fail_if(memcmp(str, target_pattern, target_pattern_size)); @@ -385,7 +385,7 @@ START_TEST(strbuf_prepend_realloc) fail_if(eina_strbuf_length_get(buf) != (runs * target_pattern_size)); str = eina_strbuf_string_get(buf); - fail_if(str == NULL); + fail_if(!str); for (i = 0; i < runs; i++, str += target_pattern_size) fail_if(memcmp(str, target_pattern, target_pattern_size)); diff --git a/legacy/eina/src/tests/eina_test_stringshare.c b/legacy/eina/src/tests/eina_test_stringshare.c index 0d34aec31c..e578b16bf6 100644 --- a/legacy/eina/src/tests/eina_test_stringshare.c +++ b/legacy/eina/src/tests/eina_test_stringshare.c @@ -82,8 +82,8 @@ START_TEST(eina_stringshare_small) t0 = eina_stringshare_add(buf); t1 = eina_stringshare_add(buf); - fail_if(t0 == NULL); - fail_if(t1 == NULL); + fail_if(!t0); + fail_if(!t1); fail_if(t0 != t1); fail_if(strcmp(t0, buf) != 0); fail_if((int)strlen(buf) != eina_stringshare_strlen(t0)); @@ -108,8 +108,8 @@ START_TEST(eina_stringshare_test_share) t0 = eina_stringshare_add(TEST0); t1 = eina_stringshare_add(TEST0); - fail_if(t0 == NULL); - fail_if(t1 == NULL); + fail_if(!t0); + fail_if(!t1); fail_if(strcmp(t0, TEST0) != 0); fail_if(strcmp(t1, TEST0) != 0); fail_if(t0 != t1); @@ -162,7 +162,7 @@ START_TEST(eina_stringshare_collision) if (rand() > RAND_MAX / 2) { const char *r = eina_stringshare_add(buffer); - fail_if(r == NULL); + fail_if(!r); } } @@ -173,9 +173,9 @@ START_TEST(eina_stringshare_collision) eina_convert_itoa(60000 - i, buffer); eina_array_push(ea, (void *)eina_stringshare_add(buffer)); r = eina_stringshare_add(buffer); - fail_if(r == NULL); + fail_if(!r); r = eina_stringshare_add(buffer); - fail_if(r == NULL); + fail_if(!r); } for (i = 0; i < 200; ++i) diff --git a/legacy/eina/src/tests/eina_test_ustr.c b/legacy/eina/src/tests/eina_test_ustr.c index c4ccd95d51..992fd257a8 100644 --- a/legacy/eina/src/tests/eina_test_ustr.c +++ b/legacy/eina/src/tests/eina_test_ustr.c @@ -133,7 +133,7 @@ START_TEST(eina_unicode_strncpy_test) /* Hopefully won't segfault */ rv = eina_unicode_strncpy(NULL, STR1, 0); - fail_if(rv != NULL); + fail_if(!!rv); eina_shutdown(); } diff --git a/legacy/eina/src/tests/eina_test_ustringshare.c b/legacy/eina/src/tests/eina_test_ustringshare.c index 1d1f7b88eb..7cd37cebde 100644 --- a/legacy/eina/src/tests/eina_test_ustringshare.c +++ b/legacy/eina/src/tests/eina_test_ustringshare.c @@ -71,8 +71,8 @@ START_TEST(eina_ustringshare_test_share) t0 = eina_ustringshare_add(TEST0); t1 = eina_ustringshare_add(TEST0); - fail_if(t0 == NULL); - fail_if(t1 == NULL); + fail_if(!t0); + fail_if(!t1); fail_if(eina_unicode_strcmp(t0, TEST0) != 0); fail_if(eina_unicode_strcmp(t1, TEST0) != 0); fail_if(t0 != t1); diff --git a/legacy/eina/src/tests/evas_list.c b/legacy/eina/src/tests/evas_list.c index d1ab651c4c..00ee11d094 100644 --- a/legacy/eina/src/tests/evas_list.c +++ b/legacy/eina/src/tests/evas_list.c @@ -1009,14 +1009,14 @@ evas_list_sort(Evas_List *list, int size, int (*func)(void *, void *)) Evas_List *prev1; Evas_List *prev2; - if (size1 == 0 || head1 == NULL) /* List1 is empty, head1 is already at the end of the list. So only need to update head2 */ + if (size1 == 0 || !head1) /* List1 is empty, head1 is already at the end of the list. So only need to update head2 */ { for (; pass_number < size_sum; ++pass_number) head2 = evas_list_next (head2); break; } else - if (size2 == 0 || head2 == NULL) /* List2 is empty, just leave */ + if (size2 == 0 || !head2) /* List2 is empty, just leave */ break; else if (func (head1->data, head2->data) < 0) diff --git a/legacy/embryo/src/bin/embryo_cc_sc1.c b/legacy/embryo/src/bin/embryo_cc_sc1.c index 2beeb38c2e..7e0b6a2941 100644 --- a/legacy/embryo/src/bin/embryo_cc_sc1.c +++ b/legacy/embryo/src/bin/embryo_cc_sc1.c @@ -179,14 +179,14 @@ sc_opensrc(char *filename) void sc_closesrc(void *handle) { - assert(handle != NULL); + assert(!!handle); fclose((FILE *) handle); } void sc_resetsrc(void *handle, void *position) { - assert(handle != NULL); + assert(!!handle); fsetpos((FILE *) handle, (fpos_t *) position); } @@ -427,7 +427,7 @@ sc_compile(int argc, char *argv[]) /* write the binary file (the file is already open) */ if (errnum == 0 && jmpcode == 0) { - assert(binf != NULL); + assert(!!binf); sc_resetasm(outf); /* flush and loop back, for reading */ assemble(binf, outf); /* assembler file is now input */ } /* if */ @@ -442,7 +442,7 @@ sc_compile(int argc, char *argv[]) free(litq); phopt_cleanup(); stgbuffer_cleanup(); - assert(jmpcode != 0 || loctab.next == NULL); /* on normal flow, + assert(jmpcode != 0 || !loctab.next); /* on normal flow, * local symbols * should already have been deleted */ delete_symbols(&loctab, 0, TRUE, TRUE); /* delete local variables @@ -1784,7 +1784,7 @@ operatorname(char *name) char *str; cell val; - assert(name != NULL); + assert(!!name); /* check the operator */ opertok = lex(&val, &str); @@ -1937,7 +1937,7 @@ operatoradjust(int opertok, symbol * sym, char *opername, int resulttag) static int check_operatortag(int opertok, int resulttag, char *opername) { - assert(opername != NULL && opername[0] != '\0'); + assert(!!opername && opername[0] != '\0'); switch (opertok) { case '!': @@ -2043,7 +2043,7 @@ funcdisplayname(char *dest, char *funcname) unary = parse_funcname(funcname, &tags[0], &tags[1], opname); tagsym[1] = find_constval_byval(&tagname_tab, tags[1]); - assert(tagsym[1] != NULL); + assert(!!tagsym[1]); if (unary) { sprintf(dest, "operator%s(%s:)", opname, tagsym[1]->name); @@ -2343,7 +2343,7 @@ newfunc(char *firstname, int firsttag, int fpublic, int fstatic, int stock) * and labels */ delete_symbols(&loctab, 0, TRUE, TRUE); /* clear local variables * queue */ - assert(loctab.next == NULL); + assert(!loctab.next); curfunc = NULL; if (sc_status == statSKIP) { @@ -2587,7 +2587,7 @@ declargs(symbol * sym) needtoken(')'); } /* if */ /* resolve any "sizeof" arguments (now that all arguments are known) */ - assert(sym->dim.arglist != NULL); + assert(!!sym->dim.arglist); arglist = sym->dim.arglist; for (idx = 0; idx < argcnt && arglist[idx].ident != 0; idx++) { @@ -2845,7 +2845,7 @@ reduce_referrers(symbol * root) { if (ref->parent) continue; /* hierarchical data type */ - assert(ref->refer != NULL); + assert(!!ref->refer); for (i = 0; i < ref->numrefers && ref->refer[i] != sym; i++) /* nothing */ ; @@ -2948,7 +2948,7 @@ calc_array_datasize(symbol * sym, cell * offset) { cell length; - assert(sym != NULL); + assert(!!sym); assert(sym->ident == iARRAY || sym->ident == iREFARRAY); length = sym->dim.array.length; if (sym->dim.array.level > 0) @@ -3606,7 +3606,7 @@ dofor(void) * "continue" must ignore these fields. */ ptr = readwhile(); - assert(ptr != NULL); + assert(!!ptr); ptr[wqBRK] = (int)declared; ptr[wqCONT] = (int)declared; jumplabel(skiplab); /* skip expression 3 1st time */ @@ -3951,7 +3951,7 @@ doreturn(void) needtoken(tTERM); rettype |= uRETVALUE; /* function returns a value */ /* check tagname with function tagname */ - assert(curfunc != NULL); + assert(!!curfunc); if (!matchtag(curfunc->tag, tag, TRUE)) error(213); /* tagname mismatch */ } @@ -3963,7 +3963,7 @@ doreturn(void) { char symname[2 * sNAMEMAX + 16]; /* allow space for user * defined operators */ - assert(curfunc != NULL); + assert(!!curfunc); funcdisplayname(symname, curfunc->name); error(209, symname); /* function should return a value */ } /* if */ diff --git a/legacy/embryo/src/bin/embryo_cc_sc2.c b/legacy/embryo/src/bin/embryo_cc_sc2.c index 67845f8e94..3548e43125 100644 --- a/legacy/embryo/src/bin/embryo_cc_sc2.c +++ b/legacy/embryo/src/bin/embryo_cc_sc2.c @@ -741,7 +741,7 @@ preproc_expr(cell * val, int *tag) */ assert(strlen(pline) < sLINEMAX); term = strchr(pline, '\0'); - assert(term != NULL); + assert(!!term); chrcat(pline, PREPROC_TERM); /* the "DEL" code (see SC.H) */ result = constexpr(val, tag); /* get value (or 0 on error) */ *term = '\0'; /* erase the token (if still present) */ @@ -756,7 +756,7 @@ preproc_expr(cell * val, int *tag) static char * getstring(char *dest, int max, char *line) { - assert(dest != NULL && line != NULL); + assert(!!dest && !!line); *dest = '\0'; while (*line <= ' ' && *line != '\0') line++; /* skip whitespace */ @@ -1133,7 +1133,7 @@ command(void) if (skiplevel == 0) { check_empty(lptr); - assert(inpf != NULL); + assert(!!inpf); if (inpf != inpf_org) sc_closesrc(inpf); inpf = NULL; @@ -2074,7 +2074,7 @@ lexclr(int clreol) if (clreol) { lptr = strchr(pline, '\0'); - assert(lptr != NULL); + assert(!!lptr); } /* if */ } @@ -2370,12 +2370,12 @@ free_symbol(symbol * sym) /* free all sub-symbol allocated memory blocks, depending on the * kind of the symbol */ - assert(sym != NULL); + assert(!!sym); if (sym->ident == iFUNCTN) { /* run through the argument list; "default array" arguments * must be freed explicitly; the tag list must also be freed */ - assert(sym->dim.arglist != NULL); + assert(!!sym->dim.arglist); for (arg = sym->dim.arglist; arg->ident != 0; arg++) { if (arg->ident == iREFARRAY && arg->hasdefault) @@ -2384,12 +2384,12 @@ free_symbol(symbol * sym) && ((arg->hasdefault & uSIZEOF) != 0 || (arg->hasdefault & uTAGOF) != 0)) free(arg->defvalue.size.symname); - assert(arg->tags != NULL); + assert(!!arg->tags); free(arg->tags); } /* for */ free(sym->dim.arglist); } /* if */ - assert(sym->refer != NULL); + assert(!!sym->refer); free(sym->refer); free(sym); } @@ -2405,7 +2405,7 @@ delete_symbol(symbol * root, symbol * sym) while (root->next != sym) { root = root->next; - assert(root != NULL); + assert(!!root); } /* while */ /* unlink it, then free it */ @@ -2518,9 +2518,9 @@ refer_symbol(symbol * entry, symbol * bywhom) { int count; - assert(bywhom != NULL); /* it makes no sense to add a "void" referrer */ - assert(entry != NULL); - assert(entry->refer != NULL); + assert(!!bywhom); /* it makes no sense to add a "void" referrer */ + assert(!!entry); + assert(!!entry->refer); /* see if it is already there */ for (count = 0; count < entry->numrefers && entry->refer[count] != bywhom; @@ -2556,7 +2556,7 @@ refer_symbol(symbol * entry, symbol * bywhom) } /* if */ /* add the referrer */ - assert(entry->refer[count] == NULL); + assert(!entry->refer[count]); entry->refer[count] = bywhom; return TRUE; } @@ -2612,7 +2612,7 @@ findconst(char *name) sym = find_symbol(&glbtab, name, fcurrent); if (!sym || sym->ident != iCONSTEXPR) return NULL; - assert(sym->parent == NULL); /* constants have no hierarchy */ + assert(!sym->parent); /* constants have no hierarchy */ return sym; } @@ -2639,9 +2639,9 @@ addsym(char *name, cell addr, int ident, int vclass, int tag, int usage) /* global variables/constants/functions may only be defined once */ assert(!(ident == iFUNCTN || ident == iCONSTEXPR) || vclass != sGLOBAL - || findglb(name) == NULL); + || !findglb(name)); /* labels may only be defined once */ - assert(ident != iLABEL || findloc(name) == NULL); + assert(ident != iLABEL || !findloc(name)); /* create an empty referrer list */ if (!(refer = (symbol **)malloc(sizeof(symbol *)))) @@ -2680,7 +2680,7 @@ addvariable(char *name, cell addr, int ident, int vclass, int tag, int level; /* global variables may only be defined once */ - assert(vclass != sGLOBAL || (sym = findglb(name)) == NULL + assert(vclass != sGLOBAL || !(sym = findglb(name)) || (sym->usage & uDEFINE) == 0); if (ident == iARRAY || ident == iREFARRAY) diff --git a/legacy/embryo/src/bin/embryo_cc_sc3.c b/legacy/embryo/src/bin/embryo_cc_sc3.c index 69bb34fe92..2760fc1cc8 100644 --- a/legacy/embryo/src/bin/embryo_cc_sc3.c +++ b/legacy/embryo/src/bin/embryo_cc_sc3.c @@ -179,7 +179,7 @@ check_userop(void (*oper) (void), int tag1, int tag2, int numparam, } else { - assert(oper != NULL); + assert(!!oper); assert(numparam == 1); /* try a select group of unary operators */ assert((sizeof unoperstr / sizeof unoperstr[0]) == @@ -248,7 +248,7 @@ check_userop(void (*oper) (void), int tag1, int tag2, int numparam, if (oper == user_inc || oper == user_dec) { assert(!savepri); - assert(lval != NULL); + assert(!!lval); if (lval->ident == iARRAYCELL || lval->ident == iARRAYCHAR) push1(); /* save current address in PRI */ rvalue(lval); /* get the symbol's value in PRI */ @@ -269,7 +269,7 @@ check_userop(void (*oper) (void), int tag1, int tag2, int numparam, * result must be stored; this address must be preserved accross the * call */ - assert(lval != NULL); /* this was checked earlier */ + assert(!!lval); /* this was checked earlier */ assert(lval->ident == iARRAYCELL || lval->ident == iARRAYCHAR); /* checked earlier */ push2(); } /* if */ @@ -308,14 +308,14 @@ check_userop(void (*oper) (void), int tag1, int tag2, int numparam, if (sym->x.lib) sym->x.lib->value += 1; /* increment "usage count" of the library */ sideeffect = TRUE; /* assume functions carry out a side-effect */ - assert(resulttag != NULL); + assert(!!resulttag); *resulttag = sym->tag; /* save tag of the called function */ if (savepri || savealt) pop2(); /* restore the saved PRI/ALT that into ALT */ if (oper == user_inc || oper == user_dec) { - assert(lval != NULL); + assert(!!lval); if (lval->ident == iARRAYCELL || lval->ident == iARRAYCHAR) pop2(); /* restore address (in ALT) */ store(lval); /* store PRI in the symbol */ @@ -787,7 +787,7 @@ array_totalsize(symbol * sym) { cell length; - assert(sym != NULL); + assert(!!sym); assert(sym->ident == iARRAY || sym->ident == iREFARRAY); length = sym->dim.array.length; if (sym->dim.array.level > 0) @@ -805,13 +805,13 @@ array_totalsize(symbol * sym) static cell array_levelsize(symbol * sym, int level) { - assert(sym != NULL); + assert(!!sym); assert(sym->ident == iARRAY || sym->ident == iREFARRAY); assert(level <= sym->dim.array.level); while (level-- > 0) { sym = finddepend(sym); - assert(sym != NULL); + assert(!!sym); } /* if */ return sym->dim.array.length; } @@ -908,7 +908,7 @@ hier14(value * lval1) /* array assignment is permitted too (with restrictions) */ if (oper) return error(23); /* array assignment must be simple assigment */ - assert(lval1->sym != NULL); + assert(!!lval1->sym); if (array_totalsize(lval1->sym) == 0) return error(46, lval1->sym->name); /* unknown array size */ lvalue = TRUE; @@ -918,7 +918,7 @@ hier14(value * lval1) if (!lvalue) return error(22); /* must be lvalue */ /* may not change "constant" parameters */ - assert(lval1->sym != NULL); + assert(!!lval1->sym); if ((lval1->sym->usage & uCONST) != 0) return error(22); /* assignment to const argument */ lval3 = *lval1; /* save symbol to enable storage of expresion result */ @@ -969,7 +969,7 @@ hier14(value * lval1) if (lval2.ident == iVARIABLE && lval3.ident == lval2.ident && lval3.sym == lval2.sym) { - assert(lval3.sym != NULL); + assert(!!lval3.sym); error(226, lval3.sym->name); /* self-assignment */ } /* if */ } /* if */ @@ -1015,7 +1015,7 @@ hier14(value * lval1) symbol *sym2 = lval2.sym; int i; - assert(sym1 != NULL && sym2 != NULL); + assert(!!sym1 && !!sym2); /* ^^^ sym2 must be valid, because only variables can be * multi-dimensional (there are no multi-dimensional arrays), * sym1 must be valid because it must be an lvalue @@ -1025,7 +1025,7 @@ hier14(value * lval1) { sym1 = finddepend(sym1); sym2 = finddepend(sym2); - assert(sym1 != NULL && sym2 != NULL); + assert(!!sym1 && !!sym2); /* ^^^ both arrays have the same dimensions (this was checked * earlier) so the dependend should always be found */ @@ -1210,7 +1210,7 @@ hier2(value * lval) case tINC: /* ++lval */ if (!hier2(lval)) return error(22); /* must be lvalue */ - assert(lval->sym != NULL); + assert(!!lval->sym); if ((lval->sym->usage & uCONST) != 0) return error(22); /* assignment to const argument */ if (!check_userop(user_inc, lval->tag, 0, 1, lval, &lval->tag)) @@ -1221,7 +1221,7 @@ hier2(value * lval) case tDEC: /* --lval */ if (!hier2(lval)) return error(22); /* must be lvalue */ - assert(lval->sym != NULL); + assert(!!lval->sym); if ((lval->sym->usage & uCONST) != 0) return error(22); /* assignment to const argument */ if (!check_userop(user_dec, lval->tag, 0, 1, lval, &lval->tag)) @@ -1300,7 +1300,7 @@ hier2(value * lval) if (sym && sym->ident != iFUNCTN && sym->ident != iREFFUNC && (sym->usage & uDEFINE) == 0) sym = NULL; /* symbol is not a function, it is in the table, but not "defined" */ - val = (sym != NULL); + val = (sym); if (!val && find_subst(st, strlen(st))) val = 1; clear_value(lval); @@ -1405,7 +1405,7 @@ hier2(value * lval) case tINC: /* lval++ */ if (!lvalue) return error(22); /* must be lvalue */ - assert(lval->sym != NULL); + assert(!!lval->sym); if ((lval->sym->usage & uCONST) != 0) return error(22); /* assignment to const argument */ /* on incrementing array cells, the address in PRI must be saved for @@ -1429,7 +1429,7 @@ hier2(value * lval) case tDEC: /* lval-- */ if (!lvalue) return error(22); /* must be lvalue */ - assert(lval->sym != NULL); + assert(!!lval->sym); if ((lval->sym->usage & uCONST) != 0) return error(22); /* assignment to const argument */ saveresult = (lval->ident == iARRAYCELL @@ -1604,7 +1604,7 @@ hier1(value * lval1) charalign(); /* align character index into array */ } /* if */ /* the indexed item may be another array (multi-dimensional arrays) */ - assert(lval1->sym == sym && sym != NULL); /* should still be set */ + assert(lval1->sym == sym && !!sym); /* should still be set */ if (sym->dim.array.level > 0) { assert(close == ']'); /* checked earlier */ @@ -1617,7 +1617,7 @@ hier1(value * lval1) /* adjust the "value" structure and find the referenced array */ lval1->ident = iREFARRAY; lval1->sym = finddepend(sym); - assert(lval1->sym != NULL); + assert(!!lval1->sym); assert(lval1->sym->dim.array.level == sym->dim.array.level - 1); /* try to parse subsequent array indices */ @@ -1778,7 +1778,7 @@ primary(value * lval) { return error(17, st); /* undefined symbol */ } /* endif */ - assert(sym != NULL); + assert(!!sym); assert(sym->ident == iFUNCTN || sym->ident != iREFFUNC); lval->sym = sym; lval->ident = sym->ident; @@ -1814,10 +1814,10 @@ setdefarray(cell * string, cell size, cell array_sz, cell * dataaddr, * the default array data is "dumped" into the data segment only once (on the * first use). */ - assert(string != NULL); + assert(!!string); assert(size > 0); /* check whether to dump the default array */ - assert(dataaddr != NULL); + assert(!!dataaddr); if (sc_status == statWRITE && *dataaddr < 0) { int i; @@ -1907,9 +1907,9 @@ callfunction(symbol * sym) cell lexval; char *lexstr; - assert(sym != NULL); + assert(!!sym); arg = sym->dim.arglist; - assert(arg != NULL); + assert(!!arg); stgmark(sSTARTREORDER); for (argpos = 0; argpos < sMAXARGS; argpos++) arglist[argpos] = ARG_UNHANDLED; @@ -1974,7 +1974,7 @@ callfunction(symbol * sym) /* always pass by reference */ if (lval.ident == iVARIABLE || lval.ident == iREFERENCE) { - assert(lval.sym != NULL); + assert(!!lval.sym); if ((lval.sym->usage & uCONST) != 0 && (arg[argidx].usage & uCONST) == 0) { @@ -2045,7 +2045,7 @@ callfunction(symbol * sym) { if (lvalue) { - assert(lval.sym != NULL); + assert(!!lval.sym); address(lval.sym); } else @@ -2121,7 +2121,7 @@ callfunction(symbol * sym) symbol *sym = lval.sym; short level = 0; - assert(sym != NULL); + assert(!!sym); if (sym->dim.array.level + 1 != arg[argidx].numdim) error(48); /* array dimensions must match */ /* the lengths for all dimensions must match, unless the dimension @@ -2137,12 +2137,12 @@ callfunction(symbol * sym) append_constval(&arrayszlst, arg[argidx].name, sym->dim.array.length, level); sym = finddepend(sym); - assert(sym != NULL); + assert(!!sym); level++; } /* if */ /* the last dimension is checked too, again, unless it is zero */ assert(level < sDIMEN_MAX); - assert(sym != NULL); + assert(!!sym); if (arg[argidx].dim[level] != 0 && sym->dim.array.length != arg[argidx].dim[level]) diff --git a/legacy/embryo/src/bin/embryo_cc_sc4.c b/legacy/embryo/src/bin/embryo_cc_sc4.c index 57cbca1fe2..85c97955cc 100644 --- a/legacy/embryo/src/bin/embryo_cc_sc4.c +++ b/legacy/embryo/src/bin/embryo_cc_sc4.c @@ -336,7 +336,7 @@ rvalue(value * lval) else if (lval->ident == iREFERENCE) { /* indirect fetch, but address not yet in PRI */ - assert(sym != NULL); + assert(!!sym); assert(sym->vclass == sLOCAL); /* global references don't exist in Small */ if (sym->vclass == sLOCAL) stgwrite("\tlref.s.pri "); @@ -349,7 +349,7 @@ rvalue(value * lval) else { /* direct or stack relative fetch */ - assert(sym != NULL); + assert(!!sym); if (sym->vclass == sLOCAL) stgwrite("\tload.s.pri "); else @@ -367,7 +367,7 @@ rvalue(value * lval) void address(symbol * sym) { - assert(sym != NULL); + assert(!!sym); /* the symbol can be a local array, a global array, or an array * that is passed by reference. */ @@ -416,7 +416,7 @@ store(value * lval) } else if (lval->ident == iREFERENCE) { - assert(sym != NULL); + assert(!!sym); if (sym->vclass == sLOCAL) stgwrite("\tsref.s.pri "); else @@ -426,7 +426,7 @@ store(value * lval) } else { - assert(sym != NULL); + assert(!!sym); markusage(sym, uWRITTEN); if (sym->vclass == sLOCAL) stgwrite("\tstor.s.pri "); @@ -455,7 +455,7 @@ memcopy(cell size) void copyarray(symbol * sym, cell size) { - assert(sym != NULL); + assert(!!sym); /* the symbol can be a local array, a global array, or an array * that is passed by reference. */ @@ -485,7 +485,7 @@ fillarray(symbol * sym, cell size, cell val) { const1(val); /* load val in PRI */ - assert(sym != NULL); + assert(!!sym); /* the symbol can be a local array, a global array, or an array * that is passed by reference. */ @@ -658,7 +658,7 @@ ffcase(cell val, char *labelname, int newtable) void ffcall(symbol * sym, int numargs) { - assert(sym != NULL); + assert(!!sym); assert(sym->ident == iFUNCTN); if ((sym->usage & uNATIVE) != 0) { @@ -1177,7 +1177,7 @@ inc(value * lval) } else if (lval->ident == iREFERENCE) { - assert(sym != NULL); + assert(!!sym); stgwrite("\tpush.pri\n"); /* load dereferenced value */ assert(sym->vclass == sLOCAL); /* global references don't exist in Small */ @@ -1200,7 +1200,7 @@ inc(value * lval) else { /* local or global variable */ - assert(sym != NULL); + assert(!!sym); if (sym->vclass == sLOCAL) stgwrite("\tinc.s "); else @@ -1243,7 +1243,7 @@ dec(value * lval) } else if (lval->ident == iREFERENCE) { - assert(sym != NULL); + assert(!!sym); stgwrite("\tpush.pri\n"); /* load dereferenced value */ assert(sym->vclass == sLOCAL); /* global references don't exist in Small */ @@ -1266,7 +1266,7 @@ dec(value * lval) else { /* local or global variable */ - assert(sym != NULL); + assert(!!sym); if (sym->vclass == sLOCAL) stgwrite("\tdec.s "); else diff --git a/legacy/embryo/src/bin/embryo_cc_sc6.c b/legacy/embryo/src/bin/embryo_cc_sc6.c index 61e182874f..2fe23d9f81 100644 --- a/legacy/embryo/src/bin/embryo_cc_sc6.c +++ b/legacy/embryo/src/bin/embryo_cc_sc6.c @@ -156,7 +156,7 @@ static void write_encoded(FILE * fbin, ucell * c, int num) { assert(sizeof(cell) <= 4); /* code must be adjusted for larger cells */ - assert(fbin != NULL); + assert(!!fbin); while (num-- > 0) { if (sc_compress) @@ -298,7 +298,7 @@ do_call(FILE * fbin, char *params, cell opcode) * already have been set (in order for static globals to be found). */ sym = findglb(name); - assert(sym != NULL); + assert(!!sym); assert(sym->ident == iFUNCTN || sym->ident == iREFFUNC); assert(sym->vclass == sGLOBAL); @@ -322,7 +322,7 @@ do_jump(FILE * fbin, char *params, cell opcode) if (fbin) { - assert(lbltab != NULL); + assert(!!lbltab); p = lbltab[i]; write_encoded(fbin, (ucell *) & opcode, 1); write_encoded(fbin, &p, 1); @@ -414,7 +414,7 @@ do_switch(FILE * fbin, char *params, cell opcode) if (fbin) { - assert(lbltab != NULL); + assert(!!lbltab); p = lbltab[i]; write_encoded(fbin, (ucell *) & opcode, 1); write_encoded(fbin, &p, 1); @@ -438,7 +438,7 @@ do_case(FILE * fbin, char *params, cell opcode __UNUSED__) if (fbin) { - assert(lbltab != NULL); + assert(!!lbltab); p = lbltab[i]; write_encoded(fbin, &v, 1); write_encoded(fbin, &p, 1); @@ -625,7 +625,7 @@ findopcode(char *instr, int maxlen) while (low < high) { mid = (low + high) / 2; - assert(opcodelist[mid].name != NULL); + assert(!!opcodelist[mid].name); cmp = strcasecmp(str, opcodelist[mid].name); if (cmp > 0) low = mid + 1; @@ -664,10 +664,10 @@ assemble(FILE * fout, FILE * fin) /* verify that the opcode list is sorted (skip entry 1; it is reserved * for a non-existant opcode) */ - assert(opcodelist[1].name != NULL); + assert(!!opcodelist[1].name); for (i = 2; i < (sizeof opcodelist / sizeof opcodelist[0]); i++) { - assert(opcodelist[i].name != NULL); + assert(!!opcodelist[i].name); assert(strcasecmp(opcodelist[i].name, opcodelist[i - 1].name) > 0); } /* for */ #endif @@ -867,7 +867,7 @@ assemble(FILE * fout, FILE * fin) char alias[sNAMEMAX + 1]; sym = nativelist[i]; - assert(sym != NULL); + assert(!!sym); if (!lookup_alias(alias, sym->name)) { assert(strlen(sym->name) <= sNAMEMAX); @@ -1044,7 +1044,7 @@ assemble(FILE * fout, FILE * fin) /* nothing */ ; assert(params > instr); i = findopcode(instr, (int)(params - instr)); - assert(opcodelist[i].name != NULL); + assert(!!opcodelist[i].name); if (opcodelist[i].segment == pass) opcodelist[i].func(fout, skipwhitespace(params), opcodelist[i].opcode); diff --git a/legacy/embryo/src/bin/embryo_cc_sc7.c b/legacy/embryo/src/bin/embryo_cc_sc7.c index c8a977e696..bdc2b8e19e 100644 --- a/legacy/embryo/src/bin/embryo_cc_sc7.c +++ b/legacy/embryo/src/bin/embryo_cc_sc7.c @@ -533,7 +533,7 @@ replacesequence(char *pattern, char symbols[_maxoptvars][_aliasmax + 1], * that the same symbol may occur multiple times in the pattern) plus * line endings and startings ('\t' to start a line and '\n\0' to end one) */ - assert(repl_length != NULL); + assert(!!repl_length); *repl_length = 0; lptr = pattern; while (*lptr) @@ -627,7 +627,7 @@ stgopt(char *start, char *end) char symbols[_maxoptvars][_aliasmax + 1]; int seq, match_length, repl_length; - assert(sequences != NULL); + assert(!!sequences); while (start < end) { if ((sc_debug & sNOOPTIMIZE) != 0 || sc_status != statWRITE) @@ -677,7 +677,7 @@ stgopt(char *start, char *end) seq++; } /* if */ } /* while */ - assert(sequences[seq].find == NULL); + assert(!sequences[seq].find); filewrite(start); } /* if */ assert(start < end); diff --git a/legacy/embryo/src/bin/embryo_cc_sclist.c b/legacy/embryo/src/bin/embryo_cc_sclist.c index 099c6b28bb..dcba3572d3 100644 --- a/legacy/embryo/src/bin/embryo_cc_sclist.c +++ b/legacy/embryo/src/bin/embryo_cc_sclist.c @@ -39,9 +39,9 @@ insert_stringpair(stringpair * root, char *first, char *second, int matchlength) { stringpair *cur, *pred; - assert(root != NULL); - assert(first != NULL); - assert(second != NULL); + assert(!!root); + assert(!!first); + assert(!!second); /* create a new node, and check whether all is okay */ if (!(cur = (stringpair *)malloc(sizeof(stringpair)))) return NULL; @@ -71,13 +71,13 @@ delete_stringpairtable(stringpair * root) { stringpair *cur, *next; - assert(root != NULL); + assert(!!root); cur = root->next; while (cur) { next = cur->next; - assert(cur->first != NULL); - assert(cur->second != NULL); + assert(!!cur->first); + assert(!!cur->second); free(cur->first); free(cur->second); free(cur); @@ -92,7 +92,7 @@ find_stringpair(stringpair * cur, char *first, int matchlength) int result = 0; assert(matchlength > 0); /* the function cannot handle zero-length comparison */ - assert(first != NULL); + assert(!!first); while (cur && result <= 0) { result = (int)*cur->first - (int)*first; @@ -112,15 +112,15 @@ delete_stringpair(stringpair * root, stringpair * item) { stringpair *cur; - assert(root != NULL); + assert(!!root); cur = root; while (cur->next) { if (cur->next == item) { cur->next = item->next; /* unlink from list */ - assert(item->first != NULL); - assert(item->second != NULL); + assert(!!item->first); + assert(!!item->second); free(item->first); free(item->second); free(item); @@ -139,9 +139,9 @@ insert_alias(char *name, char *alias) { stringpair *cur; - assert(name != NULL); + assert(!!name); assert(strlen(name) <= sNAMEMAX); - assert(alias != NULL); + assert(!!alias); assert(strlen(alias) <= sEXPMAX); if (!(cur = insert_stringpair(&alias_tab, name, alias, strlen(name)))) error(103); /* insufficient memory (fatal error) */ @@ -158,7 +158,7 @@ lookup_alias(char *target, char *name) assert(strlen(cur->second) <= sEXPMAX); strcpy(target, cur->second); } /* if */ - return cur != NULL; + return !!cur; } void @@ -175,7 +175,7 @@ insert_path(char *path) { stringlist *cur; - assert(path != NULL); + assert(!!path); if (!(cur = (stringlist *)malloc(sizeof(stringlist)))) error(103); /* insufficient memory (fatal error) */ if (!(cur->line = strdup(path))) @@ -194,7 +194,7 @@ get_path(int index) cur = cur->next; if (cur) { - assert(cur->line != NULL); + assert(!!cur->line); return cur->line; } /* if */ return NULL; @@ -208,7 +208,7 @@ delete_pathtable(void) while (cur) { next = cur->next; - assert(cur->line != NULL); + assert(!!cur->line); free(cur->line); free(cur); cur = next; @@ -240,8 +240,8 @@ insert_subst(char *pattern, char *substitution, int prefixlen) { stringpair *cur; - assert(pattern != NULL); - assert(substitution != NULL); + assert(!!pattern); + assert(!!substitution); if (!(cur = insert_stringpair(&substpair, pattern, substitution, prefixlen))) error(103); /* insufficient memory (fatal error) */ adjustindex(*pattern); @@ -253,7 +253,7 @@ find_subst(char *name, int length) { stringpair *item; - assert(name != NULL); + assert(!!name); assert(length > 0); assert((*name >= 'A' && *name <= 'Z') || (*name >= 'a' && *name <= 'z') || *name == '_'); @@ -268,7 +268,7 @@ delete_subst(char *name, int length) { stringpair *item; - assert(name != NULL); + assert(!!name); assert(length > 0); assert((*name >= 'A' && *name <= 'Z') || (*name >= 'a' && *name <= 'z') || *name == '_'); diff --git a/legacy/emotion/src/lib/emotion_smart.c b/legacy/emotion/src/lib/emotion_smart.c index 33dced3421..579b6df3fd 100644 --- a/legacy/emotion/src/lib/emotion_smart.c +++ b/legacy/emotion/src/lib/emotion_smart.c @@ -161,7 +161,7 @@ _emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module ** /* FIXME: Always look for a working backend. */ retry: - if (name == NULL || index > 0) + if (!name || index > 0) name = _backend_priority[index++]; plugin = eina_hash_find(_backends, name); diff --git a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline.c b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline.c index b3764413ac..3411172b4e 100644 --- a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline.c +++ b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline.c @@ -220,7 +220,7 @@ emotion_pipeline_cdda_track_count_get(void *video) GstMessage *message; message = gst_bus_pop(bus); - if (message == NULL) + if (!message) /* All messages read, we're done */ break; diff --git a/legacy/emotion/src/modules/xine/emotion_xine_vo_out.c b/legacy/emotion/src/modules/xine/emotion_xine_vo_out.c index 1053d1842e..f8741bdf2a 100644 --- a/legacy/emotion/src/modules/xine/emotion_xine_vo_out.c +++ b/legacy/emotion/src/modules/xine/emotion_xine_vo_out.c @@ -395,12 +395,12 @@ _emotion_frame_format_update(vo_driver_t *vo_driver, vo_frame_t *vo_frame, uint3 break; } if (((format == XINE_IMGFMT_YV12) - && ((fr->vo_frame.base[0] == NULL) - || (fr->vo_frame.base[1] == NULL) - || (fr->vo_frame.base[2] == NULL))) + && ((!fr->vo_frame.base[0]) + || (!fr->vo_frame.base[1]) + || (!fr->vo_frame.base[2]))) || ((format == XINE_IMGFMT_YUY2) - && ((fr->vo_frame.base[0] == NULL) - || (fr->frame.bgra_data == NULL)))) + && ((!fr->vo_frame.base[0]) + || (!fr->frame.bgra_data)))) { _emotion_frame_data_free(fr); } diff --git a/legacy/ethumb/src/bin/ethumbd.c b/legacy/ethumb/src/bin/ethumbd.c index 333040c51b..0de7ed5731 100644 --- a/legacy/ethumb/src/bin/ethumbd.c +++ b/legacy/ethumb/src/bin/ethumbd.c @@ -1659,7 +1659,7 @@ static int _ethumb_dbus_interface_elements_add(E_DBus_Interface *iface, struct _Ethumb_DBus_Method_Table *mtable, struct _Ethumb_DBus_Signal_Table *stable) { int i = -1; - while (mtable && mtable[++i].name != NULL) + while (mtable && mtable[++i].name) if (!e_dbus_interface_method_add(iface, mtable[i].name, mtable[i].signature, @@ -1668,7 +1668,7 @@ _ethumb_dbus_interface_elements_add(E_DBus_Interface *iface, struct _Ethumb_DBus return 0; i = -1; - while (stable && stable[++i].name != NULL) + while (stable && stable[++i].name) if (!e_dbus_interface_signal_add(iface, stable[i].name, stable[i].signature)) diff --git a/legacy/evas/src/lib/cache/evas_cache_engine_image.c b/legacy/evas/src/lib/cache/evas_cache_engine_image.c index 829380dbda..a629d4201f 100644 --- a/legacy/evas/src/lib/cache/evas_cache_engine_image.c +++ b/legacy/evas/src/lib/cache/evas_cache_engine_image.c @@ -144,7 +144,7 @@ _evas_cache_engine_image_dealloc(Evas_Cache_Engine_Image *cache, Engine_Image_En EAPI int evas_cache_engine_image_usage_get(Evas_Cache_Engine_Image *cache) { - assert(cache != NULL); + assert(!!cache); return cache->usage; } @@ -152,7 +152,7 @@ evas_cache_engine_image_usage_get(Evas_Cache_Engine_Image *cache) EAPI int evas_cache_engine_image_get(Evas_Cache_Engine_Image *cache) { - assert(cache != NULL); + assert(!!cache); return cache->limit; } @@ -160,7 +160,7 @@ evas_cache_engine_image_get(Evas_Cache_Engine_Image *cache) EAPI void evas_cache_engine_image_set(Evas_Cache_Engine_Image *cache, int limit) { - assert(cache != NULL); + assert(!!cache); cache->limit = limit; } @@ -247,7 +247,7 @@ _evas_cache_engine_image_free_cb(__UNUSED__ const Eina_Hash *hash, __UNUSED__ co EAPI void evas_cache_engine_image_flush(Evas_Cache_Engine_Image *cache) { - assert(cache != NULL); + assert(!!cache); while ((cache->lru) && (cache->limit < cache->usage)) { @@ -264,7 +264,7 @@ evas_cache_engine_image_shutdown(Evas_Cache_Engine_Image *cache) Engine_Image_Entry *eim; Eina_List *delete_list = NULL; - assert(cache != NULL); + assert(!!cache); if (cache->func.debug) cache->func.debug("shutdown-engine", NULL); @@ -303,7 +303,7 @@ evas_cache_engine_image_request(Evas_Cache_Engine_Image *cache, Image_Entry *im; const char *ekey; - assert(cache != NULL); + assert(!!cache); *error = EVAS_LOAD_ERROR_NONE; diff --git a/legacy/evas/src/lib/cache/evas_cache_image.c b/legacy/evas/src/lib/cache/evas_cache_image.c index a7d7579b33..117815d19e 100644 --- a/legacy/evas/src/lib/cache/evas_cache_image.c +++ b/legacy/evas/src/lib/cache/evas_cache_image.c @@ -74,7 +74,7 @@ _evas_cache_image_make_activ(Evas_Cache_Image *cache, { /* FIXME: Handle case when image is being processed anyway and don't do a double decode. */ im->cache_key = key; - if (key != NULL) + if (key) { im->flags.cached = 1; im->flags.activ = 1; @@ -510,7 +510,7 @@ _evas_cache_image_entry_preload_remove(Image_Entry *ie, const void *target) } } - if (ie->targets == NULL && ie->preload && !ie->flags.pending) + if (!ie->targets && ie->preload && !ie->flags.pending) { ie->cache->preload = eina_list_remove(ie->cache->preload, ie); ie->cache->pending = eina_list_append(ie->cache->pending, ie); @@ -525,7 +525,7 @@ _evas_cache_image_entry_preload_remove(Image_Entry *ie, const void *target) EAPI int evas_cache_image_usage_get(Evas_Cache_Image *cache) { - assert(cache != NULL); + assert(!!cache); return cache->usage; } @@ -533,7 +533,7 @@ evas_cache_image_usage_get(Evas_Cache_Image *cache) EAPI int evas_cache_image_get(Evas_Cache_Image *cache) { - assert(cache != NULL); + assert(!!cache); return cache->limit; } @@ -541,7 +541,7 @@ evas_cache_image_get(Evas_Cache_Image *cache) EAPI void evas_cache_image_set(Evas_Cache_Image *cache, int limit) { - assert(cache != NULL); + assert(!!cache); #ifdef EVAS_FRAME_QUEUING LKL(cache->lock); #endif @@ -698,7 +698,7 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char * size_t key_length; struct stat st; - assert(cache != NULL); + assert(!!cache); if ((!file) || ((!file) && (!key))) { @@ -1436,7 +1436,7 @@ evas_cache_image_preload_cancel(Image_Entry *im, const void *target) assert(im); assert(im->cache); - if (target == NULL) return; + if (!target) return; _evas_cache_image_entry_preload_remove(im, target); #else (void)im; diff --git a/legacy/evas/src/lib/canvas/evas_clip.c b/legacy/evas/src/lib/canvas/evas_clip.c index 1f9ce4d5bb..6623aa718f 100644 --- a/legacy/evas/src/lib/canvas/evas_clip.c +++ b/legacy/evas/src/lib/canvas/evas_clip.c @@ -133,7 +133,7 @@ evas_object_clip_set(Evas_Object *obj, Evas_Object *clip) obj->cur.clipper = NULL; } /* clip me */ - if ((clip->clip.clipees == NULL) && (clip->cur.visible)) + if ((!clip->clip.clipees) && (clip->cur.visible)) { /* Basically it just went invisible */ clip->changed = 1; diff --git a/legacy/evas/src/lib/canvas/evas_data.c b/legacy/evas/src/lib/canvas/evas_data.c index a3ddc7f6c2..4aaf475bec 100644 --- a/legacy/evas/src/lib/canvas/evas_data.c +++ b/legacy/evas/src/lib/canvas/evas_data.c @@ -48,7 +48,7 @@ evas_object_data_set(Evas_Object *obj, const char *key, const void *data) if (!key) return; evas_object_data_del(obj, key); - if (data == NULL) return; + if (!data) return; node = malloc(sizeof(Evas_Data_Node) + strlen(key) + 1); node->key = (char *)node + sizeof(Evas_Data_Node); strcpy(node->key, key); diff --git a/legacy/evas/src/lib/canvas/evas_object_box.c b/legacy/evas/src/lib/canvas/evas_object_box.c index c1923cd822..ede16ea39a 100644 --- a/legacy/evas/src/lib/canvas/evas_object_box.c +++ b/legacy/evas/src/lib/canvas/evas_object_box.c @@ -323,7 +323,7 @@ _evas_object_box_insert_at_default(Evas_Object *o, Evas_Object_Box_Data *priv, E return new_opt; } - for (l = priv->children, i = 0; l != NULL; l = l->next, i++) + for (l = priv->children, i = 0; l; l = l->next, i++) { Evas_Object_Box_Option *opt = l->data; @@ -1451,7 +1451,7 @@ _evas_object_box_layout_flow_horizontal_row_info_collect(Evas_Object_Box_Data *p int off_y = 0, max_h = 0, n_rows = 0; Eina_List *l; - for (i = 0, l = priv->children; l != NULL; i++, l = l->next) + for (i = 0, l = priv->children; l; i++, l = l->next) { Evas_Object_Box_Option *opt = l->data; int padding_l, padding_r, padding_t, padding_b; @@ -1666,7 +1666,7 @@ _evas_object_box_layout_flow_vertical_col_info_collect(Evas_Object_Box_Data *pri int off_x = 0, max_w = 0, n_cols = 0; Eina_List *l; - for (i = 0, l = priv->children; l != NULL; i++, l = l->next) + for (i = 0, l = priv->children; l; i++, l = l->next) { Evas_Object_Box_Option *opt = l->data; int padding_l, padding_r, padding_t, padding_b; diff --git a/legacy/evas/src/lib/canvas/evas_object_intercept.c b/legacy/evas/src/lib/canvas/evas_object_intercept.c index 33876857e0..0e94f746b9 100644 --- a/legacy/evas/src/lib/canvas/evas_object_intercept.c +++ b/legacy/evas/src/lib/canvas/evas_object_intercept.c @@ -54,7 +54,7 @@ evas_object_intercept_call_show(Evas_Object *obj) if (!obj->interceptors) return 0; if (obj->intercepted) return 0; obj->intercepted = 1; - ret = ((obj->interceptors->show.func) != NULL); + ret = !!(obj->interceptors->show.func); if (obj->interceptors->show.func) obj->interceptors->show.func(obj->interceptors->show.data, obj); obj->intercepted = 0; @@ -70,7 +70,7 @@ evas_object_intercept_call_hide(Evas_Object *obj) if (!obj->interceptors) return 0; if (obj->intercepted) return 0; obj->intercepted = 1; - ret = ((obj->interceptors->hide.func) != NULL); + ret = !!(obj->interceptors->hide.func); if (obj->interceptors->hide.func) obj->interceptors->hide.func(obj->interceptors->hide.data, obj); obj->intercepted = 0; @@ -86,7 +86,7 @@ evas_object_intercept_call_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) if (!obj->interceptors) return 0; if (obj->intercepted) return 0; obj->intercepted = 1; - ret = ((obj->interceptors->move.func) != NULL); + ret = !!(obj->interceptors->move.func); if (obj->interceptors->move.func) obj->interceptors->move.func(obj->interceptors->move.data, obj, x, y); obj->intercepted = 0; @@ -102,7 +102,7 @@ evas_object_intercept_call_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) if (!obj->interceptors) return 0; if (obj->intercepted) return 0; obj->intercepted = 1; - ret = ((obj->interceptors->resize.func) != NULL); + ret = !!(obj->interceptors->resize.func); if (obj->interceptors->resize.func) obj->interceptors->resize.func(obj->interceptors->resize.data, obj, w, h); obj->intercepted = 0; @@ -118,7 +118,7 @@ evas_object_intercept_call_raise(Evas_Object *obj) if (!obj->interceptors) return 0; if (obj->intercepted) return 0; obj->intercepted = 1; - ret = ((obj->interceptors->raise.func) != NULL); + ret = !!(obj->interceptors->raise.func); if (obj->interceptors->raise.func) obj->interceptors->raise.func(obj->interceptors->raise.data, obj); obj->intercepted = 0; @@ -134,7 +134,7 @@ evas_object_intercept_call_lower(Evas_Object *obj) if (!obj->interceptors) return 0; if (obj->intercepted) return 0; obj->intercepted = 1; - ret = ((obj->interceptors->lower.func) != NULL); + ret = !!(obj->interceptors->lower.func); if (obj->interceptors->lower.func) obj->interceptors->lower.func(obj->interceptors->lower.data, obj); obj->intercepted = 0; @@ -150,7 +150,7 @@ evas_object_intercept_call_stack_above(Evas_Object *obj, Evas_Object *above) if (!obj->interceptors) return 0; if (obj->intercepted) return 0; obj->intercepted = 1; - ret = ((obj->interceptors->stack_above.func) != NULL); + ret = !!(obj->interceptors->stack_above.func); if (obj->interceptors->stack_above.func) obj->interceptors->stack_above.func(obj->interceptors->stack_above.data, obj, above); obj->intercepted = 0; @@ -166,7 +166,7 @@ evas_object_intercept_call_stack_below(Evas_Object *obj, Evas_Object *below) if (!obj->interceptors) return 0; if (obj->intercepted) return 0; obj->intercepted = 1; - ret = ((obj->interceptors->stack_below.func) != NULL); + ret = !!(obj->interceptors->stack_below.func); if (obj->interceptors->stack_below.func) obj->interceptors->stack_below.func(obj->interceptors->stack_below.data, obj, below); obj->intercepted = 0; @@ -182,7 +182,7 @@ evas_object_intercept_call_layer_set(Evas_Object *obj, int l) if (!obj->interceptors) return 0; if (obj->intercepted) return 0; obj->intercepted = 1; - ret = ((obj->interceptors->layer_set.func) != NULL); + ret = !!(obj->interceptors->layer_set.func); if (obj->interceptors->layer_set.func) obj->interceptors->layer_set.func(obj->interceptors->layer_set.data, obj, l); obj->intercepted = 0; @@ -198,7 +198,7 @@ evas_object_intercept_call_color_set(Evas_Object *obj, int r, int g, int b, int if (!obj->interceptors) return 0; if (obj->intercepted) return 0; obj->intercepted = 1; - ret = ((obj->interceptors->color_set.func) != NULL); + ret = !!(obj->interceptors->color_set.func); if (obj->interceptors->color_set.func) obj->interceptors->color_set.func(obj->interceptors->color_set.data, obj, r, g, b, a); obj->intercepted = 0; @@ -214,7 +214,7 @@ evas_object_intercept_call_clip_set(Evas_Object *obj, Evas_Object *clip) if (!obj->interceptors) return 0; if (obj->intercepted) return 0; obj->intercepted = 1; - ret = ((obj->interceptors->clip_set.func) != NULL); + ret = !!(obj->interceptors->clip_set.func); if (obj->interceptors->clip_set.func) obj->interceptors->clip_set.func(obj->interceptors->clip_set.data, obj, clip); obj->intercepted = 0; @@ -230,7 +230,7 @@ evas_object_intercept_call_clip_unset(Evas_Object *obj) if (!obj->interceptors) return 0; if (obj->intercepted) return 0; obj->intercepted = 1; - ret = ((obj->interceptors->clip_unset.func) != NULL); + ret = !!(obj->interceptors->clip_unset.func); if (obj->interceptors->clip_unset.func) obj->interceptors->clip_unset.func(obj->interceptors->clip_unset.data, obj); obj->intercepted = 0; diff --git a/legacy/evas/src/lib/canvas/evas_object_smart.c b/legacy/evas/src/lib/canvas/evas_object_smart.c index cfeddd95dd..55000aa0b1 100644 --- a/legacy/evas/src/lib/canvas/evas_object_smart.c +++ b/legacy/evas/src/lib/canvas/evas_object_smart.c @@ -559,7 +559,7 @@ evas_object_smart_callbacks_descriptions_set(Evas_Object *obj, const Evas_Smart_ return 1; } - for (count = 0, d = descriptions; d->name != NULL; d++) + for (count = 0, d = descriptions; d->name; d++) count++; evas_smart_cb_descriptions_resize(&o->callbacks_descriptions, count); diff --git a/legacy/evas/src/lib/canvas/evas_object_textblock.c b/legacy/evas/src/lib/canvas/evas_object_textblock.c index 5d7cda21cd..37d30c3895 100644 --- a/legacy/evas/src/lib/canvas/evas_object_textblock.c +++ b/legacy/evas/src/lib/canvas/evas_object_textblock.c @@ -2568,7 +2568,7 @@ skip: _layout_walk_back_to_item_word_redo(c, it); goto end; } - if (c->ln->items != NULL) + if (c->ln->items) { white_stripped = _layout_item_abort(c, fmt, it); empty_item = 1; @@ -2617,7 +2617,7 @@ skip: goto end; } } - if (c->ln->items != NULL) + if (c->ln->items) { white_stripped = _layout_item_abort(c, fmt, it); empty_item = 1; diff --git a/legacy/evas/src/lib/canvas/evas_smart.c b/legacy/evas/src/lib/canvas/evas_smart.c index 8aefc2115e..c1a9b042e5 100644 --- a/legacy/evas/src/lib/canvas/evas_smart.c +++ b/legacy/evas/src/lib/canvas/evas_smart.c @@ -400,19 +400,19 @@ _evas_smart_class_callbacks_create(Evas_Smart *s) const Evas_Smart_Class *sc; unsigned int n = 0; - for (sc = s->smart_class; sc != NULL; sc = sc->parent) + for (sc = s->smart_class; sc; sc = sc->parent) { const Evas_Smart_Cb_Description *d; - for (d = sc->callbacks; d && d->name != NULL; d++) + for (d = sc->callbacks; d && d->name; d++) n++; } if (n == 0) return; if (!evas_smart_cb_descriptions_resize(&s->callbacks, n)) return; - for (n = 0, sc = s->smart_class; sc != NULL; sc = sc->parent) + for (n = 0, sc = s->smart_class; sc; sc = sc->parent) { const Evas_Smart_Cb_Description *d; - for (d = sc->callbacks; d->name != NULL; d++) + for (d = sc->callbacks; d->name; d++) s->callbacks.array[n++] = d; } evas_smart_cb_descriptions_fix(&s->callbacks); diff --git a/legacy/evas/src/lib/cserve/evas_cs_client.c b/legacy/evas/src/lib/cserve/evas_cs_client.c index cb42e8ba3b..654955e141 100644 --- a/legacy/evas/src/lib/cserve/evas_cs_client.c +++ b/legacy/evas/src/lib/cserve/evas_cs_client.c @@ -336,7 +336,7 @@ evas_cserve_image_load(Image_Entry *ie, const char *file, const char *key, RGBA_ ie->data1 = rep->handle; } if (rep) free(rep); - if (ie->data1 == NULL) return 0; + if (!ie->data1) return 0; ie->connect_num = connect_num; if (cserve) ie->server_id = cserve->server_id; @@ -353,7 +353,7 @@ evas_cserve_image_data_load(Image_Entry *ie) if (csrve_init > 0) server_reinit(); else return 0; if (!cserve) return 0; - if (ie->data1 == NULL) return 0; + if (!ie->data1) return 0; if (cserve->server_id != ie->server_id) { ie->data1 = NULL; @@ -391,7 +391,7 @@ evas_cserve_image_free(Image_Entry *ie) if (csrve_init > 0) server_reinit(); else return; if (!cserve) return; - if (ie->data1 == NULL) return; + if (!ie->data1) return; memset(&msg, 0, sizeof(msg)); msg.handle = ie->data1; msg.server_id = cserve->server_id; @@ -416,7 +416,7 @@ evas_cserve_image_unload(Image_Entry *ie) if (csrve_init > 0) server_reinit(); else return; if (!cserve) return; - if (ie->data1 == NULL) return; + if (!ie->data1) return; if (ie->connect_num != connect_num) return; memset(&msg, 0, sizeof(msg)); msg.handle = ie->data1; @@ -438,7 +438,7 @@ evas_cserve_image_useless(Image_Entry *ie) if (csrve_init > 0) server_reinit(); else return; if (!cserve) return; - if (ie->data1 == NULL) return; + if (!ie->data1) return; if (ie->connect_num != connect_num) return; memset(&msg, 0, sizeof(msg)); msg.handle = ie->data1; diff --git a/legacy/evas/src/lib/engines/common/evas_font_load.c b/legacy/evas/src/lib/engines/common/evas_font_load.c index 4acbc9f52e..8ea3188f38 100644 --- a/legacy/evas/src/lib/engines/common/evas_font_load.c +++ b/legacy/evas/src/lib/engines/common/evas_font_load.c @@ -131,7 +131,7 @@ evas_common_font_source_memory_load(const char *name, const void *data, int data int error; RGBA_Font_Source *fs; - assert(name != NULL); + assert(!!name); fs = calloc(1, sizeof(RGBA_Font_Source) + data_size); if (!fs) return NULL; @@ -164,7 +164,7 @@ evas_common_font_source_load(const char *name) { RGBA_Font_Source *fs; - assert(name != NULL); + assert(!!name); fs = calloc(1, sizeof(RGBA_Font_Source)); if (!fs) return NULL; diff --git a/legacy/evas/src/lib/engines/common/evas_image_main.c b/legacy/evas/src/lib/engines/common/evas_image_main.c index 785fb1ef83..a307fe3447 100644 --- a/legacy/evas/src/lib/engines/common/evas_image_main.c +++ b/legacy/evas/src/lib/engines/common/evas_image_main.c @@ -242,7 +242,7 @@ _evas_common_rgba_image_surface_alloc(Image_Entry *ie, int w, int h) if (im->image.data) free(im->image.data); im->image.data = malloc(siz); - if (im->image.data == NULL) return -1; + if (!im->image.data) return -1; #ifdef HAVE_VALGRIND # ifdef VALGRIND_MAKE_READABLE @@ -529,7 +529,7 @@ evas_common_image_colorspace_dirty(RGBA_Image *im) EAPI void evas_common_image_set_cache(int size) { - if (eci != NULL) + if (eci) evas_cache_image_set(eci, size); } @@ -542,7 +542,7 @@ evas_common_image_get_cache(void) EAPI RGBA_Image * evas_common_load_image_from_file(const char *file, const char *key, RGBA_Image_Loadopts *lo, int *error) { - if (file == NULL) + if (!file) { *error = EVAS_LOAD_ERROR_GENERIC; return NULL; diff --git a/legacy/evas/src/lib/engines/common/evas_pipe.c b/legacy/evas/src/lib/engines/common/evas_pipe.c index cf532a41b9..d0d0f8141a 100644 --- a/legacy/evas/src/lib/engines/common/evas_pipe.c +++ b/legacy/evas/src/lib/engines/common/evas_pipe.c @@ -346,7 +346,7 @@ evas_common_frameq_thread(void *data) /* 1. pick a frame to draw */ LKL(frameq->mutex); - while(frame == NULL) + while(!frame) { EINA_INLIST_FOREACH(EINA_INLIST_GET(frameq->frames), frame) { @@ -567,7 +567,7 @@ get_max_interval() static long long tv_to_long_long(struct timeval *tv) { - if (tv == NULL) + if (!tv) { return 0; } diff --git a/legacy/evas/src/lib/engines/common/evas_tiler.c b/legacy/evas/src/lib/engines/common/evas_tiler.c index c29359f1fe..852513b3aa 100644 --- a/legacy/evas/src/lib/engines/common/evas_tiler.c +++ b/legacy/evas/src/lib/engines/common/evas_tiler.c @@ -19,7 +19,7 @@ rect_list_node_pool_set_max(int max) int diff; diff = list_node_pool.len - max; - for (; diff > 0 && list_node_pool.node != NULL; diff--) + for (; diff > 0 && list_node_pool.node; diff--) { list_node_t *node; @@ -104,10 +104,10 @@ rect_list_print(const list_t rects) int len; len = 0; - for (node = rects.head; node != NULL; node = node->next) len++; + for (node = rects.head; node; node = node->next) len++; putchar('['); - for (node = rects.head; node != NULL; node = node->next) + for (node = rects.head; node; node = node->next) { rect_print(((rect_node_t *)node)->rect); if (node->next) @@ -775,7 +775,7 @@ rect_list_merge_rects(list_t *rects, list_t *to_merge, int accepted_error) merged = 0; parent_node = NULL; node = rects->head; - while (node != NULL) + while (node) { rect_t r2, outer; int area; @@ -1060,7 +1060,7 @@ evas_common_tilebuf_add_motion_vector(Tilebuf *tb, int x, int y, int w, int h, i num = _add_redraw(&lr, tb->outbuf_w, tb->outbuf_h, x, y, w, h); num += _add_redraw(&lr, tb->outbuf_w, tb->outbuf_h, x + dx, y + dy, w, h); - while (lr.head != NULL) + while (lr.head) { list_node_t *node = rect_list_unlink_next(&lr, NULL); rect_list_add_split_fuzzy_and_merge(&tb->rects, node, @@ -1109,7 +1109,7 @@ evas_common_tilebuf_get_render_rects(Tilebuf *tb) tb->need_merge = 0; } - for (n = tb->rects.head; n != NULL; n = n->next) { + for (n = tb->rects.head; n; n = n->next) { rect_t cur; cur = ((rect_node_t *)n)->rect; diff --git a/legacy/evas/src/lib/file/evas_module.c b/legacy/evas/src/lib/file/evas_module.c index 22c931347e..4906e7fe8f 100644 --- a/legacy/evas/src/lib/file/evas_module.c +++ b/legacy/evas/src/lib/file/evas_module.c @@ -260,7 +260,7 @@ evas_module_init(void) evas_engines = eina_array_new(4); - for (i = 0; evas_static_module[i].init != NULL; ++i) + for (i = 0; evas_static_module[i].init; ++i) evas_static_module[i].init(); } @@ -397,7 +397,7 @@ int evas_module_load(Evas_Module *em) { if (em->loaded) return 1; - if (em->definition == NULL) return 0; + if (!em->definition) return 0; if (!em->definition->func.open(em)) return 0; em->loaded = 1; @@ -413,7 +413,7 @@ evas_module_unload(Evas_Module *em) { if (!em->loaded) return; - if (em->definition == NULL) + if (!em->definition) return ; // for now lets not unload modules - they may still be in use. @@ -515,7 +515,7 @@ evas_module_shutdown(void) char *path; int i; - for (i = 0; evas_static_module[i].shutdown != NULL; ++i) + for (i = 0; evas_static_module[i].shutdown; ++i) evas_static_module[i].shutdown(); EINA_LIST_FREE(eina_evas_modules, en) diff --git a/legacy/evas/src/modules/engines/direct3d/evas_engine.c b/legacy/evas/src/modules/engines/direct3d/evas_engine.c index 6d6912d982..0081e25e67 100644 --- a/legacy/evas/src/modules/engines/direct3d/evas_engine.c +++ b/legacy/evas/src/modules/engines/direct3d/evas_engine.c @@ -97,7 +97,7 @@ eng_setup(Evas *e, void *info) Evas_Engine_Info_Direct3D *in; re = (Render_Engine *)e->engine.data.output; in = (Evas_Engine_Info_Direct3D *)info; - if (e->engine.data.output == NULL) + if (!e->engine.data.output) { e->engine.data.output = _output_setup(e->output.w, e->output.h, @@ -108,22 +108,22 @@ eng_setup(Evas *e, void *info) } else if (in->info.fullscreen != 0) { - if (re != NULL) + if (re) evas_direct3d_set_layered(re->d3d, 0, 0, 0, NULL); evas_direct3d_set_fullscreen(re->d3d, -1, -1, 1); } else if (in->info.fullscreen == 0) { evas_direct3d_set_fullscreen(re->d3d, re->width, re->height, 0); - if (re != NULL && in->info.layered == 0) + if (re && in->info.layered == 0) evas_direct3d_set_layered(re->d3d, 0, 0, 0, NULL); - else if (re != NULL && in->info.layered != 0 && in->shape != NULL) + else if (re && in->info.layered != 0 && in->shape) evas_direct3d_set_layered(re->d3d, 1, in->shape->width, in->shape->height, in->shape->mask); } - if (e->engine.data.output == NULL) + if (!e->engine.data.output) return 0; - if (e->engine.data.context == NULL) + if (!e->engine.data.context) e->engine.data.context = e->engine.func->context_new(e->engine.data.output); return 1; diff --git a/legacy/evas/src/modules/engines/software_16_x11/evas_x_buffer.c b/legacy/evas/src/modules/engines/software_16_x11/evas_x_buffer.c index 8e569f779e..3340cbfe95 100644 --- a/legacy/evas/src/modules/engines/software_16_x11/evas_x_buffer.c +++ b/legacy/evas/src/modules/engines/software_16_x11/evas_x_buffer.c @@ -68,7 +68,7 @@ evas_software_x11_x_output_buffer_new(Display *d, Visual *v, int depth, int w, i xob->shm_info->readOnly = False; xob->shm_info->shmaddr = xob->xim->data = shmat(xob->shm_info->shmid, 0, 0); - if (xob->shm_info->shmaddr != NULL) + if (xob->shm_info->shmaddr) { XErrorHandler ph; diff --git a/legacy/evas/src/modules/engines/software_8_x11/evas_x_buffer.c b/legacy/evas/src/modules/engines/software_8_x11/evas_x_buffer.c index 6c6b667c31..a02abb21a4 100644 --- a/legacy/evas/src/modules/engines/software_8_x11/evas_x_buffer.c +++ b/legacy/evas/src/modules/engines/software_8_x11/evas_x_buffer.c @@ -74,7 +74,7 @@ evas_software_x11_x_output_buffer_new(xcb_connection_t * c, xob->shm_info->shmaddr = xob->xim->data = shmat(xob->shm_info->shmid, 0, 0); - if (xob->shm_info->shmaddr != NULL) + if (xob->shm_info->shmaddr) { /* * FIXME: no error mechanism diff --git a/legacy/evas/src/modules/engines/software_x11/evas_xcb_buffer.c b/legacy/evas/src/modules/engines/software_x11/evas_xcb_buffer.c index c7e9c74331..304c1f2e7d 100644 --- a/legacy/evas/src/modules/engines/software_x11/evas_xcb_buffer.c +++ b/legacy/evas/src/modules/engines/software_x11/evas_xcb_buffer.c @@ -319,7 +319,7 @@ evas_software_xcb_x_output_buffer_new(xcb_connection_t *c, { xcbob->shm_info->shmaddr = xcbob->image->data = shmat(xcbob->shm_info->shmid, 0, 0); - if (xcbob->shm_info->shmaddr != NULL) + if (xcbob->shm_info->shmaddr) { /* * FIXME: no error mechanism diff --git a/legacy/evas/src/modules/engines/software_x11/evas_xlib_buffer.c b/legacy/evas/src/modules/engines/software_x11/evas_xlib_buffer.c index 873a67e7a3..af0b691d94 100644 --- a/legacy/evas/src/modules/engines/software_x11/evas_xlib_buffer.c +++ b/legacy/evas/src/modules/engines/software_x11/evas_xlib_buffer.c @@ -294,7 +294,7 @@ evas_software_xlib_x_output_buffer_new(Display *d, Visual *v, int depth, int w, xob->shm_info->readOnly = False; xob->shm_info->shmaddr = xob->xim->data = shmat(xob->shm_info->shmid, 0, 0); - if (xob->shm_info->shmaddr != NULL) + if (xob->shm_info->shmaddr) { XErrorHandler ph; diff --git a/legacy/evas/src/modules/engines/xrender_x11/evas_engine_xcb_ximage.c b/legacy/evas/src/modules/engines/xrender_x11/evas_engine_xcb_ximage.c index a0c60ca965..cdbcb9bc62 100644 --- a/legacy/evas/src/modules/engines/xrender_x11/evas_engine_xcb_ximage.c +++ b/legacy/evas/src/modules/engines/xrender_x11/evas_engine_xcb_ximage.c @@ -333,7 +333,7 @@ _xr_xcb_image_info_get(xcb_connection_t *conn, xcb_screen_t *screen, xcb_drawabl shm_info.shmid = shmget(IPC_PRIVATE, xim->size, IPC_CREAT | 0777); if (shm_info.shmid >= 0) { shm_info.shmaddr = xim->data = shmat(shm_info.shmid, 0, 0); - if ((shm_info.shmaddr != NULL) && (shm_info.shmaddr != (void *) -1)) { + if ((shm_info.shmaddr) && (shm_info.shmaddr != (void *) -1)) { xcb_get_input_focus_reply_t *reply; /* * FIXME: no error mechanism diff --git a/legacy/evas/src/modules/loaders/tiff/evas_image_load_tiff.c b/legacy/evas/src/modules/loaders/tiff/evas_image_load_tiff.c index f6a70cdd64..773fa24f48 100644 --- a/legacy/evas/src/modules/loaders/tiff/evas_image_load_tiff.c +++ b/legacy/evas/src/modules/loaders/tiff/evas_image_load_tiff.c @@ -305,7 +305,7 @@ evas_image_load_file_data_tiff(Image_Entry *ie, const char *file, const char *ke return EINA_FALSE; } - if (rgba_image.rgba.put.any == NULL) + if (!rgba_image.rgba.put.any) { ERR("Evas Tiff loader: no put function"); diff --git a/legacy/evas/src/modules/savers/png/evas_image_save_png.c b/legacy/evas/src/modules/savers/png/evas_image_save_png.c index 7938f08402..be399c6841 100644 --- a/legacy/evas/src/modules/savers/png/evas_image_save_png.c +++ b/legacy/evas/src/modules/savers/png/evas_image_save_png.c @@ -55,7 +55,7 @@ save_image_png(RGBA_Image *im, const char *file, int compress, int interlace) goto close_file; info_ptr = png_create_info_struct(png_ptr); - if (info_ptr == NULL) + if (!info_ptr) { png_destroy_write_struct(&png_ptr, NULL); goto close_file; diff --git a/legacy/evil/src/lib/evil_langinfo.c b/legacy/evil/src/lib/evil_langinfo.c index 9632b7b139..560f6adf8f 100644 --- a/legacy/evil/src/lib/evil_langinfo.c +++ b/legacy/evil/src/lib/evil_langinfo.c @@ -10,7 +10,7 @@ static char * replace(char *prev, char *value) { - if (value == NULL) + if (!value) return prev; if (prev) @@ -30,7 +30,7 @@ nl_langinfo(nl_item index) { char *p; result = replace(result, setlocale(LC_CTYPE, NULL)); - if ((p = strrchr(result, '.' )) == NULL) + if (!(p = strrchr(result, '.'))) return nothing; if ((++p - result) > 2) diff --git a/legacy/evil/src/lib/evil_pwd.c b/legacy/evil/src/lib/evil_pwd.c index 9b50facc07..0830b5b26a 100644 --- a/legacy/evil/src/lib/evil_pwd.c +++ b/legacy/evil/src/lib/evil_pwd.c @@ -56,7 +56,7 @@ getpwuid (uid_t uid) pw.pw_gecos = (res ? user_name : NULL); pw.pw_dir = (char *)evil_homedir_get(); pw.pw_shell = getenv("SHELL"); - if (pw.pw_shell == NULL) + if (!pw.pw_shell) pw.pw_shell = "sh"; pw.pw_expire = 0; pw.pw_fields = 0;