Only run init when count is 1 and shutdown when count is 0

SVN revision: 16649
This commit is contained in:
sebastid 2005-09-07 08:57:08 +00:00 committed by sebastid
parent efe51da1dc
commit b6ce3afdb5
4 changed files with 8 additions and 8 deletions

View File

@ -9,7 +9,7 @@ static int init = 0;
int
ecore_file_init()
{
if (++init > 1) return init;
if (++init != 1) return init;
if (!ecore_file_monitor_init())
goto error;
@ -31,7 +31,7 @@ error:
int
ecore_file_shutdown()
{
if (--init > 0) return init;
if (--init != 0) return init;
ecore_file_monitor_shutdown();
ecore_file_path_shutdown();

View File

@ -33,7 +33,7 @@ static fd_set _current_fd_set;
int
ecore_file_download_init(void)
{
if (++init > 1) return init;
if (++init != 1) return init;
#ifdef HAVE_CURL
FD_ZERO(&_current_fd_set);
@ -56,7 +56,7 @@ ecore_file_download_init(void)
int
ecore_file_download_shutdown(void)
{
if (--init > 0) return init;
if (--init != 0) return init;
#ifdef HAVE_CURL
Ecore_File_Download_Job *job;

View File

@ -23,7 +23,7 @@ static Ecore_File_Monitor_Type monitor_type = ECORE_FILE_MONITOR_TYPE_NONE;
int
ecore_file_monitor_init(void)
{
if (++init > 1) return init;
if (++init != 1) return init;
#ifdef HAVE_INOTIFY
monitor_type = ECORE_FILE_MONITOR_TYPE_INOTIFY;
@ -49,7 +49,7 @@ ecore_file_monitor_init(void)
int
ecore_file_monitor_shutdown(void)
{
if (--init > 0) return init;
if (--init != 0) return init;
switch (monitor_type)
{

View File

@ -11,7 +11,7 @@ static Ecore_List *_ecore_file_path_from_env(const char *env);
int
ecore_file_path_init(void)
{
if (++init > 1) return init;
if (++init != 1) return init;
__ecore_file_path_bin = _ecore_file_path_from_env("PATH");
return init;
}
@ -19,7 +19,7 @@ ecore_file_path_init(void)
int
ecore_file_path_shutdown(void)
{
if (--init > 0) return init;
if (--init != 0) return init;
ecore_list_destroy(__ecore_file_path_bin);
return init;
}