9 #define DEFINE_SMARTPTR(func, type, name) \
10 struct deleter_##func { \
11 void operator()(type* p) {\
16 typedef std::unique_ptr<type, deleter_##func> name;
18 // Custom freeing functions
20 void closePtr(int *fd);
22 // Defining specializations of unique_ptr
24 DEFINE_SMARTPTR(free, char, CStringPtr);
25 DEFINE_SMARTPTR(closePtr, int, FdUniquePtr);
26 DEFINE_SMARTPTR(smack_accesses_free, smack_accesses, SmackAccessesPtr);
27 DEFINE_SMARTPTR(closedir, DIR, DirPtr);
28 DEFINE_SMARTPTR(globfree, glob_t, GlobPtr);
32 typedef FdUniquePtr SockUniquePtr;
33 typedef CStringPtr SmackLabelPtr;
34 typedef CStringPtr CookieUniquePtr;