reworked default drop implementation
This commit is contained in:
parent
9f3bfcb879
commit
5cb53f39f2
6
core/src/drop.c
Normal file
6
core/src/drop.c
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#include "drop.h"
|
||||||
|
#include "stdlib.h"
|
||||||
|
|
||||||
|
void default_drop(void* data) {
|
||||||
|
free(data);
|
||||||
|
}
|
|
@ -19,8 +19,13 @@ static inline Drop T##_as_Drop(T* x) {\
|
||||||
return (Drop){.tc = &tc, .data = x};\
|
return (Drop){.tc = &tc, .data = x};\
|
||||||
}
|
}
|
||||||
|
|
||||||
#define impl_default_Drop_for(T)\
|
extern void default_drop(void*);
|
||||||
static void default_drop_##T(T* v) { free(v); }\
|
|
||||||
impl_Drop_for(T, default_drop_##T)
|
|
||||||
|
|
||||||
|
#define impl_default_Drop_for(T)\
|
||||||
|
static inline Drop T##_as_Drop(T* x) {\
|
||||||
|
static IDrop const tc = {\
|
||||||
|
.drop = default_drop,\
|
||||||
|
};\
|
||||||
|
return (Drop){.tc = &tc, .data = x};\
|
||||||
|
}
|
||||||
#endif // !_fencer_drop_h
|
#endif // !_fencer_drop_h
|
||||||
|
|
Loading…
Reference in a new issue