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
This commit is contained in:
Lucas De Marchi 2010-08-21 13:52:25 +00:00
parent 8b35111094
commit 5a8a8c9014
126 changed files with 523 additions and 523 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 == '_');

View File

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

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More