]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/plugins/fd/fd_common.h
Don't define DLL_IMP_EXP twice in fd_common.h
[bacula/bacula] / bacula / src / plugins / fd / fd_common.h
1 /*
2    Bacula® - The Network Backup Solution
3
4    Copyright (C) 2010-2010 Bacula Systems(R) SA
5
6    The main author of Bacula is Kern Sibbald, with contributions from
7    many others, a complete list can be found in the file AUTHORS.
8    This program is Free Software; you can modify it under the terms of
9    version three of the GNU Affero General Public License as published by the Free
10    Software Foundation, which is listed in the file LICENSE.
11
12    This program is distributed in the hope that it will be useful, but
13    WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15    General Public License for more details.
16
17    You should have received a copy of the GNU Affero General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20    02110-1301, USA.
21
22    Bacula® is a registered trademark of Kern Sibbald.
23    Bacula Systems(R) is a trademark of Bacula Systems SA.
24    Bacula Enterprise(TM) is a trademark of Bacula Systems SA.
25
26    The licensor of Bacula Enterprise(TM) is Bacula Systems(R) SA,
27    Rue Galilee 5, 1400 Yverdon-les-Bains, Switzerland.
28 */
29
30 /* You can include this file to your plugin to have
31  * access to some common tools and utilities provided by Bacula
32  */
33
34 #ifndef PCOMMON_H
35 #define PCOMMON_H
36
37 #define JT_BACKUP                'B'  /* Backup Job */
38 #define JT_RESTORE               'R'  /* Restore Job */
39
40 #define L_FULL                   'F'  /* Full backup */
41 #define L_INCREMENTAL            'I'  /* since last backup */
42 #define L_DIFFERENTIAL           'D'  /* since last full backup */
43
44 #ifndef DLL_IMP_EXP
45 # if defined(BUILDING_DLL)
46 #   define DLL_IMP_EXP   __declspec(dllexport)
47 # elif defined(USING_DLL)
48 #   define DLL_IMP_EXP   __declspec(dllimport)
49 # else
50 #   define DLL_IMP_EXP
51 # endif
52 #endif
53
54 DLL_IMP_EXP void *sm_malloc(const char *fname, int lineno, unsigned int nbytes);
55 DLL_IMP_EXP void sm_free(const char *file, int line, void *fp);
56 DLL_IMP_EXP void *reallymalloc(const char *fname, int lineno, unsigned int nbytes);
57 DLL_IMP_EXP void reallyfree(const char *file, int line, void *fp);
58 DLL_IMP_EXP void sm_check(const char *fname, int lineno, bool dump);
59
60 #ifndef bmalloc
61 # define bmalloc(s)      sm_malloc(__FILE__, __LINE__, (s))
62 # define bfree(o)        sm_free(__FILE__, __LINE__, (o))
63 #endif
64
65 #define SM_CHECK sm_check(__FILE__, __LINE__, false)
66
67 #ifdef malloc
68 #undef malloc
69 #undef free
70 #endif
71
72 #define malloc(s)    sm_malloc(__FILE__, __LINE__, (s))
73 #define free(o)      sm_free(__FILE__, __LINE__, (o))
74
75 inline void *operator new(size_t size, char const * file, int line)
76 {
77    void *pnew = sm_malloc(file,line, size);
78    memset((char *)pnew, 0, size);
79    return pnew;
80 }
81
82 inline void *operator new[](size_t size, char const * file, int line)
83 {
84    void *pnew = sm_malloc(file, line, size);
85    memset((char *)pnew, 0, size);
86    return pnew;
87 }
88
89 inline void *operator new(size_t size)
90 {
91    void *pnew = sm_malloc(__FILE__, __LINE__, size);
92    memset((char *)pnew, 0, size);
93    return pnew;
94 }
95
96 inline void *operator new[](size_t size)
97 {
98    void *pnew = sm_malloc(__FILE__, __LINE__, size);
99    memset((char *)pnew, 0, size);
100    return pnew;
101 }
102
103 #define new   new(__FILE__, __LINE__)
104
105 inline void operator delete(void *buf)
106 {
107    sm_free( __FILE__, __LINE__, buf);
108 }
109
110 inline void operator delete[] (void *buf)
111 {
112   sm_free(__FILE__, __LINE__, buf);
113 }
114
115 #define Dmsg(context, level, message, ...) bfuncs->DebugMessage(context, __FILE__, __LINE__, level, message, ##__VA_ARGS__)
116 #define Jmsg(context, type, message, ...) bfuncs->JobMessage(context, __FILE__, __LINE__, type, 0, message, ##__VA_ARGS__)
117
118 #endif