5#ifndef LIBMV_C_API_UTILDEFINES_H_
6#define LIBMV_C_API_UTILDEFINES_H_
8#if defined(_MSC_VER) && _MSC_VER < 1900
9# define __func__ __FUNCTION__
10# define snprintf _snprintf
13#ifdef WITH_LIBMV_GUARDED_ALLOC
16# define LIBMV_OBJECT_NEW(type, args...) \
17 new (MEM_mallocN(sizeof(type), __func__)) type(args)
19# define LIBMV_OBJECT_NEW(type, ...) \
20 new (MEM_mallocN(sizeof(type), __FUNCTION__)) type(__VA_ARGS__)
22# define LIBMV_OBJECT_DELETE(what, type) \
25 ((type*)what)->~type(); \
30# define LIBMV_STRUCT_NEW(type, count) \
31 (type*)MEM_mallocN(sizeof(type) * count, __func__)
32# define LIBMV_STRUCT_DELETE(what) MEM_freeN(what)
35# if defined __GNUC__ || defined __sun
36# define LIBMV_OBJECT_NEW(type, args...) \
37 new (malloc(sizeof(type))) type(args)
39# define LIBMV_OBJECT_NEW(type, ...) \
40 new (malloc(sizeof(type))) type(__VA_ARGS__)
42# define LIBMV_OBJECT_DELETE(what, type) \
45 ((type*)(what))->~type(); \
50# define LIBMV_STRUCT_NEW(type, count) (type*)malloc(sizeof(type) * count)
51# define LIBMV_STRUCT_DELETE(what) \
Read Guarded memory(de)allocation.