20 #ifndef LIBMV_C_API_UTILDEFINES_H_
21 #define LIBMV_C_API_UTILDEFINES_H_
23 #if defined(_MSC_VER) && _MSC_VER < 1900
24 # define __func__ __FUNCTION__
25 # define snprintf _snprintf
28 #ifdef WITH_LIBMV_GUARDED_ALLOC
30 # define LIBMV_OBJECT_NEW OBJECT_GUARDED_NEW
31 # define LIBMV_OBJECT_DELETE OBJECT_GUARDED_DELETE
32 # define LIBMV_OBJECT_DELETE OBJECT_GUARDED_DELETE
33 # define LIBMV_STRUCT_NEW(type, count) \
34 (type*)MEM_mallocN(sizeof(type) * count, __func__)
35 # define LIBMV_STRUCT_DELETE(what) MEM_freeN(what)
38 # if defined __GNUC__ || defined __sun
39 # define LIBMV_OBJECT_NEW(type, args...) \
40 new (malloc(sizeof(type))) type(args)
42 # define LIBMV_OBJECT_NEW(type, ...) \
43 new (malloc(sizeof(type))) type(__VA_ARGS__)
45 # define LIBMV_OBJECT_DELETE(what, type) \
48 ((type*)(what))->~type(); \
53 # define LIBMV_STRUCT_NEW(type, count) (type*)malloc(sizeof(type) * count)
54 # define LIBMV_STRUCT_DELETE(what) \
Read Guarded memory(de)allocation.