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
devs/devilhorns/wayland_egl
Lucas De Marchi 13 years ago
parent 8b35111094
commit 5a8a8c9014
  1. 8
      legacy/ecore/src/bin/ecore_config.c
  2. 16
      legacy/ecore/src/lib/ecore/ecore_exe.c
  3. 2
      legacy/ecore/src/lib/ecore/ecore_exe_win32.c
  4. 18
      legacy/ecore/src/lib/ecore/ecore_getopt.c
  5. 2
      legacy/ecore/src/lib/ecore/ecore_main.c
  6. 2
      legacy/ecore/src/lib/ecore/ecore_pipe.c
  7. 8
      legacy/ecore/src/lib/ecore_con/ecore_con.c
  8. 2
      legacy/ecore/src/lib/ecore_con/ecore_con_ares.c
  9. 8
      legacy/ecore/src/lib/ecore_con/ecore_con_url.c
  10. 2
      legacy/ecore/src/lib/ecore_config/ecore_config_extra.c
  11. 6
      legacy/ecore/src/lib/ecore_evas/ecore_evas.c
  12. 2
      legacy/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c
  13. 2
      legacy/ecore/src/lib/ecore_evas/ecore_evas_directfb.c
  14. 2
      legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c
  15. 2
      legacy/ecore/src/lib/ecore_evas/ecore_evas_sdl.c
  16. 4
      legacy/ecore/src/lib/ecore_evas/ecore_evas_win32.c
  17. 2
      legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c
  18. 2
      legacy/ecore/src/lib/ecore_evas/ecore_evas_x.c
  19. 2
      legacy/ecore/src/lib/ecore_fb/ecore_fb_ts.c
  20. 6
      legacy/ecore/src/lib/ecore_file/ecore_file.c
  21. 2
      legacy/ecore/src/lib/ecore_file/ecore_file_download.c
  22. 10
      legacy/ecore/src/lib/ecore_win32/ecore_win32_dnd.c
  23. 8
      legacy/ecore/src/lib/ecore_win32/ecore_win32_window.c
  24. 2
      legacy/ecore/src/lib/ecore_x/xlib/ecore_x.c
  25. 2
      legacy/ecore/src/lib/ecore_x/xlib/ecore_x_image.c
  26. 2
      legacy/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c
  27. 2
      legacy/ecore/src/lib/ecore_x/xlib/ecore_x_window.c
  28. 4
      legacy/ecore/src/tests/ecore_suite.c
  29. 12
      legacy/ecore/src/tests/ecore_test_ecore.c
  30. 2
      legacy/edje/src/bin/edje_cc_handlers.c
  31. 2
      legacy/edje/src/bin/edje_cc_parse.c
  32. 4
      legacy/edje/src/bin/edje_convert.c
  33. 4
      legacy/edje/src/bin/edje_convert_main.c
  34. 2
      legacy/edje/src/bin/edje_player.c
  35. 2
      legacy/edje/src/lib/edje_calc.c
  36. 4
      legacy/edje/src/lib/edje_convert.c
  37. 4
      legacy/edje/src/lib/edje_embryo.c
  38. 2
      legacy/edje/src/lib/edje_entry.c
  39. 2
      legacy/edje/src/lib/edje_external.c
  40. 8
      legacy/edje/src/lib/edje_load.c
  41. 6
      legacy/edje/src/lib/edje_lua.c
  42. 8
      legacy/edje/src/lib/edje_match.c
  43. 2
      legacy/edje/src/lib/edje_message_queue.c
  44. 2
      legacy/edje/src/lib/edje_private.h
  45. 8
      legacy/edje/src/lib/edje_program.c
  46. 4
      legacy/edje/src/lib/edje_text.c
  47. 14
      legacy/edje/src/lib/edje_util.c
  48. 16
      legacy/eet/src/lib/eet_cipher.c
  49. 12
      legacy/eet/src/lib/eet_data.c
  50. 8
      legacy/eet/src/lib/eet_dictionary.c
  51. 4
      legacy/eet/src/lib/eet_image.c
  52. 14
      legacy/eet/src/lib/eet_lib.c
  53. 8
      legacy/eet/src/lib/eet_node.c
  54. 66
      legacy/eet/src/tests/eet_suite.c
  55. 2
      legacy/efreet/src/lib/efreet_desktop_command.c
  56. 6
      legacy/efreet/src/lib/efreet_icon.c
  57. 2
      legacy/efreet/src/lib/efreet_ini.c
  58. 8
      legacy/efreet/src/lib/efreet_menu.c
  59. 2
      legacy/efreet/src/tests/compare/efreet_alloc.c
  60. 12
      legacy/efreet/src/tests/ef_data_dirs.c
  61. 4
      legacy/efreet/src/tests/ef_icon_theme.c
  62. 2
      legacy/efreet/src/tests/ef_locale.c
  63. 2
      legacy/efreet/src/tests/ef_mime.c
  64. 4
      legacy/efreet/src/tests/efreet_suite.c
  65. 4
      legacy/efreet/src/tests/main.c
  66. 4
      legacy/eina/src/include/eina_safety_checks.h
  67. 2
      legacy/eina/src/lib/eina_file.c
  68. 4
      legacy/eina/src/lib/eina_hash.c
  69. 12
      legacy/eina/src/lib/eina_inlist.c
  70. 14
      legacy/eina/src/lib/eina_list.c
  71. 12
      legacy/eina/src/lib/eina_log.c
  72. 38
      legacy/eina/src/lib/eina_matrixsparse.c
  73. 20
      legacy/eina/src/lib/eina_rbtree.c
  74. 4
      legacy/eina/src/lib/eina_share_common.c
  75. 4
      legacy/eina/src/lib/eina_tiler.c
  76. 10
      legacy/eina/src/tests/ecore_list.c
  77. 2
      legacy/eina/src/tests/eina_bench.c
  78. 4
      legacy/eina/src/tests/eina_suite.c
  79. 14
      legacy/eina/src/tests/eina_test_binshare.c
  80. 10
      legacy/eina/src/tests/eina_test_hash.c
  81. 34
      legacy/eina/src/tests/eina_test_list.c
  82. 14
      legacy/eina/src/tests/eina_test_matrixsparse.c
  83. 4
      legacy/eina/src/tests/eina_test_mempool.c
  84. 14
      legacy/eina/src/tests/eina_test_rbtree.c
  85. 20
      legacy/eina/src/tests/eina_test_str.c
  86. 4
      legacy/eina/src/tests/eina_test_strbuf.c
  87. 14
      legacy/eina/src/tests/eina_test_stringshare.c
  88. 2
      legacy/eina/src/tests/eina_test_ustr.c
  89. 4
      legacy/eina/src/tests/eina_test_ustringshare.c
  90. 4
      legacy/eina/src/tests/evas_list.c
  91. 28
      legacy/embryo/src/bin/embryo_cc_sc1.c
  92. 34
      legacy/embryo/src/bin/embryo_cc_sc2.c
  93. 60
      legacy/embryo/src/bin/embryo_cc_sc3.c
  94. 24
      legacy/embryo/src/bin/embryo_cc_sc4.c
  95. 20
      legacy/embryo/src/bin/embryo_cc_sc6.c
  96. 6
      legacy/embryo/src/bin/embryo_cc_sc7.c
  97. 40
      legacy/embryo/src/bin/embryo_cc_sclist.c
  98. 2
      legacy/emotion/src/lib/emotion_smart.c
  99. 2
      legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline.c
  100. 10
      legacy/emotion/src/modules/xine/emotion_xine_vo_out.c
  101. Some files were not shown because too many files have changed in this diff Show More

@ -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)

@ -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;

@ -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);

@ -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;

@ -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));

@ -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;

@ -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);

@ -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;

@ -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;

@ -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 + | */

@ -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",

@ -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;

@ -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;

@ -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;

@ -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;

@ -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;

@ -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; */

@ -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;

@ -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 */

@ -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;

@ -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

@ -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);
}

@ -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;

@ -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);

@ -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);

@ -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)))

@ -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;

@ -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);

@ -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();

@ -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);

@ -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

@ -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);

@ -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];

@ -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)
{

@ -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)
{

@ -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);

@ -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;

@ -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) ||

@ -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;

@ -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));

@ -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;
}

@ -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;

@ -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 */

@ -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;
}

@ -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;

@ -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

@ -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