Skip to content

Commit 95d02bc

Browse files
committed
feat allocator: added clean template
Signed-off-by: John Sanpe <sanpeqf@gmail.com>
1 parent 6c8d532 commit 95d02bc

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

include/bfdev/allocator.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include <bfdev/config.h>
1111
#include <bfdev/types.h>
1212
#include <bfdev/stddef.h>
13+
#include <bfdev/guards.h>
14+
#include <bfdev/errptr.h>
1315

1416
BFDEV_BEGIN_DECLS
1517

@@ -125,6 +127,11 @@ bfdev_realloc_array(const bfdev_alloc_t *alloc,
125127
return bfdev_realloc(alloc, block, size * nr);
126128
}
127129

130+
BFDEV_DEFINE_CLEAN(bfdev_free, void *,
131+
if (!BFDEV_IS_INVAL(_T))
132+
bfdev_free(BFDEV_NULL, _T);
133+
)
134+
128135
BFDEV_END_DECLS
129136

130137
#endif /* _BFDEV_ALLOCATOR_H_ */

0 commit comments

Comments
 (0)