summaryrefslogtreecommitdiff
path: root/src/cobj.h
diff options
context:
space:
mode:
authorLibravatar Mubashshir <ahmubashshir@gmail.com>2025-05-22 23:07:54 +0600
committerLibravatar Mubashshir <ahmubashshir@gmail.com>2025-05-22 23:41:24 +0600
commit7475b4879cdc270c1d7723686ae7e9ad3c0e0736 (patch)
tree33e8c410ac086aeaac7fd00a0b32b23ae6e287a8 /src/cobj.h
parent29b8e5efb43bdb71737f1b417fedb3b1558bb9af (diff)
downloadc-obp-example-7475b4879cdc270c1d7723686ae7e9ad3c0e0736.tar.gz
c-obp-example-7475b4879cdc270c1d7723686ae7e9ad3c0e0736.zip
Auto Add Deleter to classHEADmaster
Signed-off-by: Mubashshir <ahmubashshir@gmail.com>
Diffstat (limited to 'src/cobj.h')
-rw-r--r--src/cobj.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/cobj.h b/src/cobj.h
index 1e5c75e..328a6aa 100644
--- a/src/cobj.h
+++ b/src/cobj.h
@@ -6,7 +6,6 @@
# undef DefaultDelete
# undef Define
# undef Del
-# undef DelF
# undef Func
# undef GET
# undef Get
@@ -71,10 +70,12 @@
# define New(klass, body, ...) \
klass klass ## _new(__VA_ARGS__) { \
klass self = (klass)malloc(sizeof(TYPE(klass))); \
- if(self != NULL) body; \
+ if(self != NULL) { \
+ self->destroy = (& klass ## _delete); \
+ body; \
+ } \
return self; \
}
-
# define Del(klass, body, ...) \
void klass ## _delete(klass self, ## __VA_ARGS__) \
body
@@ -85,8 +86,6 @@
# define Func(klass, name) \
(self->name) = (& klass ## _ ## name)
-# define DelF(klass) \
- (self->destroy) = (&klass ## _delete)
# define Self(name) \
self->_property_ ## name