4 #ifndef LIBMV_C_API_UTILDEFINES_H_
5 #define LIBMV_C_API_UTILDEFINES_H_
7 #if defined(_MSC_VER) && _MSC_VER < 1900
8 # define __func__ __FUNCTION__
9 # define snprintf _snprintf
12 #ifdef WITH_LIBMV_GUARDED_ALLOC
15 # define LIBMV_OBJECT_NEW(type, args...) \
16 new (MEM_mallocN(sizeof(type), __func__)) type(args)
18 # define LIBMV_OBJECT_NEW(type, ...) \
19 new (MEM_mallocN(sizeof(type), __FUNCTION__)) type(__VA_ARGS__)
21 # define LIBMV_OBJECT_DELETE(what, type) \
24 ((type*)what)->~type(); \
29 # define LIBMV_STRUCT_NEW(type, count) \
30 (type*)MEM_mallocN(sizeof(type) * count, __func__)
31 # define LIBMV_STRUCT_DELETE(what) MEM_freeN(what)
34 # if defined __GNUC__ || defined __sun
35 # define LIBMV_OBJECT_NEW(type, args...) \
36 new (malloc(sizeof(type))) type(args)
38 # define LIBMV_OBJECT_NEW(type, ...) \
39 new (malloc(sizeof(type))) type(__VA_ARGS__)
41 # define LIBMV_OBJECT_DELETE(what, type) \
44 ((type*)(what))->~type(); \
49 # define LIBMV_STRUCT_NEW(type, count) (type*)malloc(sizeof(type) * count)
50 # define LIBMV_STRUCT_DELETE(what) \
Read Guarded memory(de)allocation.