Add CapstoneMallocTraits

This commit is contained in:
Double Sine
2019-01-16 15:00:30 +08:00
parent 5bd419e2ce
commit 10a119b483
+10 -1
View File
@@ -6,10 +6,19 @@
struct CapstoneHandleTraits {
using HandleType = csh;
static inline const HandleType InvalidValue = 0;
static inline void Releasor(csh Handle) {
static inline void Releasor(HandleType Handle) {
cs_close(&Handle);
}
};
template<typename __Type>
struct CapstoneMallocTraits {
using HandleType = __Type*;
static inline const HandleType InvalidValue = nullptr;
static inline void Releasor(HandleType Handle) {
cs_free(Handle, 1);
}
};
#endif