summaryrefslogtreecommitdiff
path: root/src/lib/ecore
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2017-09-26 11:13:06 -0700
committerCedric BAIL <cedric@osg.samsung.com>2017-09-26 11:13:06 -0700
commit37d6bc03fda9a0ef3e5ffe27d2f687fa3dfa28e8 (patch)
treeef418b453685247d25dbb5a47ddf0327eca0e95c /src/lib/ecore
parent9b416d236079da8603c9c3cc4b5f3d013d74976e (diff)
ecore: we can actually inherit from Efl.Object, just not in the first position.
Diffstat (limited to 'src/lib/ecore')
-rw-r--r--src/lib/ecore/efl_io_closer_fd.c21
-rw-r--r--src/lib/ecore/efl_io_closer_fd.eo3
2 files changed, 7 insertions, 17 deletions
diff --git a/src/lib/ecore/efl_io_closer_fd.c b/src/lib/ecore/efl_io_closer_fd.c
index e55de422af..3696d176bb 100644
--- a/src/lib/ecore/efl_io_closer_fd.c
+++ b/src/lib/ecore/efl_io_closer_fd.c
@@ -8,7 +8,7 @@
8#include <fcntl.h> 8#include <fcntl.h>
9#include "ecore_private.h" 9#include "ecore_private.h"
10 10
11#define MY_CLASS EFL_IO_CLOSER_FD_CLASS 11#define MY_CLASS EFL_IO_CLOSER_FD_MIXIN
12 12
13typedef struct _Efl_Io_Closer_Fd_Data 13typedef struct _Efl_Io_Closer_Fd_Data
14{ 14{
@@ -16,28 +16,25 @@ typedef struct _Efl_Io_Closer_Fd_Data
16 16
17 Eina_Bool close_on_exec; 17 Eina_Bool close_on_exec;
18 Eina_Bool close_on_destructor; 18 Eina_Bool close_on_destructor;
19 Eina_Bool initialized;
20} Efl_Io_Closer_Fd_Data; 19} Efl_Io_Closer_Fd_Data;
21 20
22static void 21static Efl_Object *
23_efl_io_closer_initialize(Efl_Io_Closer_Fd_Data *pd) 22_efl_io_closer_fd_efl_object_constructor(Eo *obj, Efl_Io_Closer_Fd_Data *pd)
24{ 23{
25 if (pd->initialized) return ;
26 pd->fd = -1; 24 pd->fd = -1;
27 pd->initialized = EINA_TRUE; 25
26 return efl_constructor(efl_super(obj, MY_CLASS));
28} 27}
29 28
30EOLIAN static void 29EOLIAN static void
31_efl_io_closer_fd_closer_fd_set(Eo *o EINA_UNUSED, Efl_Io_Closer_Fd_Data *pd, int fd) 30_efl_io_closer_fd_closer_fd_set(Eo *o EINA_UNUSED, Efl_Io_Closer_Fd_Data *pd, int fd)
32{ 31{
33 _efl_io_closer_initialize(pd);
34 pd->fd = fd; 32 pd->fd = fd;
35} 33}
36 34
37EOLIAN static int 35EOLIAN static int
38_efl_io_closer_fd_closer_fd_get(Eo *o EINA_UNUSED, Efl_Io_Closer_Fd_Data *pd) 36_efl_io_closer_fd_closer_fd_get(Eo *o EINA_UNUSED, Efl_Io_Closer_Fd_Data *pd)
39{ 37{
40 _efl_io_closer_initialize(pd);
41 return pd->fd; 38 return pd->fd;
42} 39}
43 40
@@ -47,7 +44,6 @@ _efl_io_closer_fd_efl_io_closer_close(Eo *o, Efl_Io_Closer_Fd_Data *pd EINA_UNUS
47 int fd; 44 int fd;
48 Eina_Error err = 0; 45 Eina_Error err = 0;
49 46
50 _efl_io_closer_initialize(pd);
51 fd = efl_io_closer_fd_get(o); 47 fd = efl_io_closer_fd_get(o);
52 48
53 EINA_SAFETY_ON_TRUE_RETURN_VAL(fd < 0, EBADF); 49 EINA_SAFETY_ON_TRUE_RETURN_VAL(fd < 0, EBADF);
@@ -61,15 +57,12 @@ _efl_io_closer_fd_efl_io_closer_close(Eo *o, Efl_Io_Closer_Fd_Data *pd EINA_UNUS
61EOLIAN static Eina_Bool 57EOLIAN static Eina_Bool
62_efl_io_closer_fd_efl_io_closer_closed_get(Eo *o, Efl_Io_Closer_Fd_Data *pd EINA_UNUSED) 58_efl_io_closer_fd_efl_io_closer_closed_get(Eo *o, Efl_Io_Closer_Fd_Data *pd EINA_UNUSED)
63{ 59{
64 _efl_io_closer_initialize(pd);
65 return efl_io_closer_fd_get(o) < 0; 60 return efl_io_closer_fd_get(o) < 0;
66} 61}
67 62
68EOLIAN static Eina_Bool 63EOLIAN static Eina_Bool
69_efl_io_closer_fd_efl_io_closer_close_on_exec_set(Eo *o, Efl_Io_Closer_Fd_Data *pd, Eina_Bool close_on_exec) 64_efl_io_closer_fd_efl_io_closer_close_on_exec_set(Eo *o, Efl_Io_Closer_Fd_Data *pd, Eina_Bool close_on_exec)
70{ 65{
71 _efl_io_closer_initialize(pd);
72
73#ifdef _WIN32 66#ifdef _WIN32
74 DBG("close on exec is not supported on windows"); 67 DBG("close on exec is not supported on windows");
75 pd->close_on_exec = close_on_exec; 68 pd->close_on_exec = close_on_exec;
@@ -101,8 +94,6 @@ _efl_io_closer_fd_efl_io_closer_close_on_exec_set(Eo *o, Efl_Io_Closer_Fd_Data *
101EOLIAN static Eina_Bool 94EOLIAN static Eina_Bool
102_efl_io_closer_fd_efl_io_closer_close_on_exec_get(Eo *o, Efl_Io_Closer_Fd_Data *pd) 95_efl_io_closer_fd_efl_io_closer_close_on_exec_get(Eo *o, Efl_Io_Closer_Fd_Data *pd)
103{ 96{
104 _efl_io_closer_initialize(pd);
105
106#ifdef _WIN32 97#ifdef _WIN32
107 return pd->close_on_exec; 98 return pd->close_on_exec;
108 (void)o; 99 (void)o;
@@ -130,14 +121,12 @@ _efl_io_closer_fd_efl_io_closer_close_on_exec_get(Eo *o, Efl_Io_Closer_Fd_Data *
130EOLIAN static void 121EOLIAN static void
131_efl_io_closer_fd_efl_io_closer_close_on_destructor_set(Eo *o EINA_UNUSED, Efl_Io_Closer_Fd_Data *pd, Eina_Bool close_on_destructor) 122_efl_io_closer_fd_efl_io_closer_close_on_destructor_set(Eo *o EINA_UNUSED, Efl_Io_Closer_Fd_Data *pd, Eina_Bool close_on_destructor)
132{ 123{
133 _efl_io_closer_initialize(pd);
134 pd->close_on_destructor = close_on_destructor; 124 pd->close_on_destructor = close_on_destructor;
135} 125}
136 126
137EOLIAN static Eina_Bool 127EOLIAN static Eina_Bool
138_efl_io_closer_fd_efl_io_closer_close_on_destructor_get(Eo *o EINA_UNUSED, Efl_Io_Closer_Fd_Data *pd) 128_efl_io_closer_fd_efl_io_closer_close_on_destructor_get(Eo *o EINA_UNUSED, Efl_Io_Closer_Fd_Data *pd)
139{ 129{
140 _efl_io_closer_initialize(pd);
141 return pd->close_on_destructor; 130 return pd->close_on_destructor;
142} 131}
143 132
diff --git a/src/lib/ecore/efl_io_closer_fd.eo b/src/lib/ecore/efl_io_closer_fd.eo
index 8c7f9920e1..9a95c3a777 100644
--- a/src/lib/ecore/efl_io_closer_fd.eo
+++ b/src/lib/ecore/efl_io_closer_fd.eo
@@ -1,4 +1,4 @@
1mixin Efl.Io.Closer.Fd (Efl.Io.Closer) { 1mixin Efl.Io.Closer.Fd (Efl.Io.Closer, Efl.Object) {
2 [[Close fd using close(2). 2 [[Close fd using close(2).
3 3
4 @since 1.19 4 @since 1.19
@@ -16,6 +16,7 @@ mixin Efl.Io.Closer.Fd (Efl.Io.Closer) {
16 } 16 }
17 17
18 implements { 18 implements {
19 Efl.Object.constructor;
19 Efl.Io.Closer.close; 20 Efl.Io.Closer.close;
20 Efl.Io.Closer.closed { get; } 21 Efl.Io.Closer.closed { get; }
21 Efl.Io.Closer.close_on_exec { get; set; } 22 Efl.Io.Closer.close_on_exec { get; set; }