// 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);
}
{
Ecore_Config_Prop *e;
e = ecore_config_get(key);
- if(e == NULL) return -1;
+ if(!e) return -1;
ecore_config_dst(e);
return 0;
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)
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)))
ECORE_FD_READ,
_ecore_exe_data_error_handler,
exe, NULL, NULL);
- if (exe->error_fd_handler == NULL)
+ if (!exe->error_fd_handler)
ok = 0;
}
}
ECORE_FD_READ,
_ecore_exe_data_read_handler,
exe, NULL, NULL);
- if (exe->read_fd_handler == NULL)
+ if (!exe->read_fd_handler)
ok = 0;
}
}
}
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);
{
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).",
{
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)
}
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;
}
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);
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);
}
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
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;
}
pchoice = desc->action_param.choices;
- for (; *pchoice != NULL; pchoice++)
+ for (; *pchoice; pchoice++)
if (strcmp(*pchoice, arg_val) == 0)
{
*val->strp = (char *)*pchoice;
(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);
}
return -1;
}
- if ((argc < 1) || (argv == NULL))
+ if ((argc < 1) || (!argv))
ecore_app_args_get(&argc, &argv);
if (argc < 1)
return -1;
}
- if (argv[0] != NULL)
+ if (argv[0])
prog = argv[0];
else
prog = parser->prog;
/* 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));
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;
unsigned char *inbuf;
inbuf = malloc(num);
- if(inbuf == NULL)
+ if(!inbuf)
return 1;
memcpy(inbuf, buf, num);
/* 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;
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;
cl->client_addr_len);
inbuf = malloc(num);
- if(inbuf == NULL)
+ if(!inbuf)
{
free(cl->client_addr);
free(cl);
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;
}
# if LIBCURL_VERSION_NUM >= 0x071301
- if ((username != NULL) && (password != NULL))
+ if ((username) && (password))
{
if (safe)
curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPAUTH,
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,
{
_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);
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;
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 + | */
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;
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)
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",
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;
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;
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;
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;
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; */
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;
}
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; */
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;
{
#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 */
if (!dirs) return -1;
- for (; *dirs != NULL; dirs++)
+ for (; *dirs; dirs++)
if (ecore_file_mkdir(*dirs))
i++;
return i;
#endif
i = 0;
- for (; *subdirs != NULL; subdirs++)
+ for (; *subdirs; subdirs++)
{
struct stat st;
if (!paths) return -1;
- for (; *paths != NULL; paths++)
+ for (; *paths; paths++)
if (ecore_file_mkpath(*paths))
i++;
return i;
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
STGMEDIUM stgmed = { TYMED_HGLOBAL, { 0 }, 0 };
int res = 0;
- if (data == NULL)
+ if (!data)
return 0;
if (size < 0)
size = strlen(data) + 1;
{
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);
}
INF("destroying window");
- if (wnd->shape.mask != NULL)
+ if (wnd->shape.mask)
free(wnd->shape.mask);
DestroyWindow(((struct _Ecore_Win32_Window *)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)
{
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;
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);
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);
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)))
VisualClassMask,
&vi_in,
&nvi);
- if (xvi == NULL)
+ if (!xvi)
return 0;
vis = NULL;
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
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);
fail_if(ret != 1);
timer = ecore_timer_add(0.0, _quit_cb, &did);
- fail_if(timer == NULL);
+ fail_if(!timer);
ecore_main_loop_begin();
fail_if(ret != 1);
idler = ecore_idler_add(_quit_cb, &did);
- fail_if(idler == NULL);
+ fail_if(!idler);
ecore_main_loop_begin();
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();
/* 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();
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();