parent
ebaf552ccd
commit
efe51da1dc
|
@ -3,29 +3,41 @@
|
|||
*/
|
||||
#include "ecore_file_private.h"
|
||||
|
||||
static int init = 0;
|
||||
|
||||
/* externally accessible functions */
|
||||
int
|
||||
ecore_file_init()
|
||||
{
|
||||
if (++init > 1) return init;
|
||||
|
||||
if (!ecore_file_monitor_init())
|
||||
return 0;
|
||||
goto error;
|
||||
if (!ecore_file_path_init())
|
||||
return 0;
|
||||
goto error;
|
||||
if (!ecore_file_download_init())
|
||||
return 0;
|
||||
return 1;
|
||||
goto error;
|
||||
return init;
|
||||
|
||||
error:
|
||||
|
||||
ecore_file_monitor_shutdown();
|
||||
ecore_file_path_shutdown();
|
||||
ecore_file_download_shutdown();
|
||||
|
||||
return --init;
|
||||
}
|
||||
|
||||
int
|
||||
ecore_file_shutdown()
|
||||
{
|
||||
if (!ecore_file_monitor_shutdown())
|
||||
return 0;
|
||||
if (!ecore_file_path_shutdown())
|
||||
return 0;
|
||||
if (!ecore_file_download_shutdown())
|
||||
return 0;
|
||||
return 1;
|
||||
if (--init > 0) return init;
|
||||
|
||||
ecore_file_monitor_shutdown();
|
||||
ecore_file_path_shutdown();
|
||||
ecore_file_download_shutdown();
|
||||
|
||||
return init;
|
||||
}
|
||||
|
||||
time_t
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
*/
|
||||
#include "ecore_file_private.h"
|
||||
|
||||
static int init = 0;
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
#include <curl/curl.h>
|
||||
|
||||
|
@ -31,10 +33,12 @@ static fd_set _current_fd_set;
|
|||
int
|
||||
ecore_file_download_init(void)
|
||||
{
|
||||
if (++init > 1) return init;
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
FD_ZERO(&_current_fd_set);
|
||||
_job_list = ecore_list_new();
|
||||
if (!_job_list) return 0;
|
||||
if (!_job_list) return --init;
|
||||
|
||||
if (curl_global_init(CURL_GLOBAL_NOTHING)) return 0;
|
||||
|
||||
|
@ -43,15 +47,16 @@ ecore_file_download_init(void)
|
|||
{
|
||||
ecore_list_destroy(_job_list);
|
||||
_job_list = NULL;
|
||||
return 0;
|
||||
return --init;
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
return init;
|
||||
}
|
||||
|
||||
int
|
||||
ecore_file_download_shutdown(void)
|
||||
{
|
||||
if (--init > 0) return init;
|
||||
#ifdef HAVE_CURL
|
||||
Ecore_File_Download_Job *job;
|
||||
|
||||
|
@ -72,7 +77,7 @@ ecore_file_download_shutdown(void)
|
|||
curl_multi_cleanup(curlm);
|
||||
curl_global_cleanup();
|
||||
#endif
|
||||
return 1;
|
||||
return init;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
*/
|
||||
#include "ecore_file_private.h"
|
||||
|
||||
static int init = 0;
|
||||
|
||||
typedef enum {
|
||||
ECORE_FILE_MONITOR_TYPE_NONE,
|
||||
#ifdef HAVE_INOTIFY
|
||||
|
@ -21,48 +23,55 @@ static Ecore_File_Monitor_Type monitor_type = ECORE_FILE_MONITOR_TYPE_NONE;
|
|||
int
|
||||
ecore_file_monitor_init(void)
|
||||
{
|
||||
if (++init > 1) return init;
|
||||
|
||||
#ifdef HAVE_INOTIFY
|
||||
monitor_type = ECORE_FILE_MONITOR_TYPE_INOTIFY;
|
||||
if (ecore_file_monitor_inotify_init())
|
||||
return 1;
|
||||
return init;
|
||||
#endif
|
||||
#ifdef HAVE_FAM
|
||||
#if 0
|
||||
monitor_type = ECORE_FILE_MONITOR_TYPE_FAM;
|
||||
if (ecore_file_monitor_fam_init())
|
||||
return 1;
|
||||
return init;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HAVE_POLL
|
||||
monitor_type = ECORE_FILE_MONITOR_TYPE_POLL;
|
||||
if (ecore_file_monitor_poll_init())
|
||||
return 1;
|
||||
return init;
|
||||
#endif
|
||||
monitor_type = ECORE_FILE_MONITOR_TYPE_NONE;
|
||||
return 0;
|
||||
return --init;
|
||||
}
|
||||
|
||||
int
|
||||
ecore_file_monitor_shutdown(void)
|
||||
{
|
||||
if (--init > 0) return init;
|
||||
|
||||
switch (monitor_type)
|
||||
{
|
||||
case ECORE_FILE_MONITOR_TYPE_NONE:
|
||||
return 1;
|
||||
break;
|
||||
#ifdef HAVE_INOTIFY
|
||||
case ECORE_FILE_MONITOR_TYPE_INOTIFY:
|
||||
return ecore_file_monitor_inotify_shutdown();
|
||||
ecore_file_monitor_inotify_shutdown();
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_FAM
|
||||
case ECORE_FILE_MONITOR_TYPE_FAM:
|
||||
return ecore_file_monitor_fam_shutdown();
|
||||
ecore_file_monitor_fam_shutdown();
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_POLL
|
||||
case ECORE_FILE_MONITOR_TYPE_POLL:
|
||||
return ecore_file_monitor_poll_shutdown();
|
||||
ecore_file_monitor_poll_shutdown();
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
return init;
|
||||
}
|
||||
|
||||
Ecore_File_Monitor *
|
||||
|
|
|
@ -3,22 +3,25 @@
|
|||
*/
|
||||
#include "ecore_file_private.h"
|
||||
|
||||
Ecore_List *__ecore_file_path_bin;
|
||||
static int init = 0;
|
||||
static Ecore_List *__ecore_file_path_bin;
|
||||
|
||||
static Ecore_List *_ecore_file_path_from_env(const char *env);
|
||||
|
||||
int
|
||||
ecore_file_path_init(void)
|
||||
{
|
||||
if (++init > 1) return init;
|
||||
__ecore_file_path_bin = _ecore_file_path_from_env("PATH");
|
||||
return 1;
|
||||
return init;
|
||||
}
|
||||
|
||||
int
|
||||
ecore_file_path_shutdown(void)
|
||||
{
|
||||
if (--init > 0) return init;
|
||||
ecore_list_destroy(__ecore_file_path_bin);
|
||||
return 1;
|
||||
return init;
|
||||
}
|
||||
|
||||
Ecore_List *
|
||||
|
|
Loading…
Reference in New Issue