diff options
author | Vincent Torri <vincent.torri@gmail.com> | 2009-10-10 05:28:43 +0000 |
---|---|---|
committer | Vincent Torri <vincent.torri@gmail.com> | 2009-10-10 05:28:43 +0000 |
commit | 4072d0b23d3c3803932c6f82ec89555b52e3b8a2 (patch) | |
tree | ee18a18b8d3d63083a276c94f0387ff5d5636185 /legacy/ecore/src/lib/ecore_file/ecore_file_monitor.c | |
parent | 1d869a9ab18b75ac4c6da60f99841f212ba43eaf (diff) |
* check the returned value of the _init() functions
* simplify a bit the init/shutdown functions
SVN revision: 42995
Diffstat (limited to 'legacy/ecore/src/lib/ecore_file/ecore_file_monitor.c')
-rw-r--r-- | legacy/ecore/src/lib/ecore_file/ecore_file_monitor.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/legacy/ecore/src/lib/ecore_file/ecore_file_monitor.c b/legacy/ecore/src/lib/ecore_file/ecore_file_monitor.c index 32c1b20c3c..3eec572abe 100644 --- a/legacy/ecore/src/lib/ecore_file/ecore_file_monitor.c +++ b/legacy/ecore/src/lib/ecore_file/ecore_file_monitor.c | |||
@@ -8,8 +8,6 @@ | |||
8 | 8 | ||
9 | #include "ecore_file_private.h" | 9 | #include "ecore_file_private.h" |
10 | 10 | ||
11 | static int init = 0; | ||
12 | |||
13 | typedef enum { | 11 | typedef enum { |
14 | ECORE_FILE_MONITOR_TYPE_NONE, | 12 | ECORE_FILE_MONITOR_TYPE_NONE, |
15 | #ifdef HAVE_INOTIFY | 13 | #ifdef HAVE_INOTIFY |
@@ -25,27 +23,23 @@ static Ecore_File_Monitor_Type monitor_type = ECORE_FILE_MONITOR_TYPE_NONE; | |||
25 | int | 23 | int |
26 | ecore_file_monitor_init(void) | 24 | ecore_file_monitor_init(void) |
27 | { | 25 | { |
28 | if (++init != 1) return init; | ||
29 | |||
30 | #ifdef HAVE_INOTIFY | 26 | #ifdef HAVE_INOTIFY |
31 | monitor_type = ECORE_FILE_MONITOR_TYPE_INOTIFY; | 27 | monitor_type = ECORE_FILE_MONITOR_TYPE_INOTIFY; |
32 | if (ecore_file_monitor_inotify_init()) | 28 | if (ecore_file_monitor_inotify_init()) |
33 | return init; | 29 | return 1; |
34 | #endif | 30 | #endif |
35 | #ifdef HAVE_POLL | 31 | #ifdef HAVE_POLL |
36 | monitor_type = ECORE_FILE_MONITOR_TYPE_POLL; | 32 | monitor_type = ECORE_FILE_MONITOR_TYPE_POLL; |
37 | if (ecore_file_monitor_poll_init()) | 33 | if (ecore_file_monitor_poll_init()) |
38 | return init; | 34 | return 1; |
39 | #endif | 35 | #endif |
40 | monitor_type = ECORE_FILE_MONITOR_TYPE_NONE; | 36 | monitor_type = ECORE_FILE_MONITOR_TYPE_NONE; |
41 | return --init; | 37 | return 0; |
42 | } | 38 | } |
43 | 39 | ||
44 | int | 40 | void |
45 | ecore_file_monitor_shutdown(void) | 41 | ecore_file_monitor_shutdown(void) |
46 | { | 42 | { |
47 | if (--init != 0) return init; | ||
48 | |||
49 | switch (monitor_type) | 43 | switch (monitor_type) |
50 | { | 44 | { |
51 | case ECORE_FILE_MONITOR_TYPE_NONE: | 45 | case ECORE_FILE_MONITOR_TYPE_NONE: |
@@ -61,7 +55,6 @@ ecore_file_monitor_shutdown(void) | |||
61 | break; | 55 | break; |
62 | #endif | 56 | #endif |
63 | } | 57 | } |
64 | return init; | ||
65 | } | 58 | } |
66 | 59 | ||
67 | /** | 60 | /** |