From: Eric Bollengier Date: Tue, 23 Nov 2010 10:38:36 +0000 (+0100) Subject: Don't define DLL_IMP_EXP twice in fd_common.h X-Git-Tag: Release-5.2.1~890 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=563711de96fa6a8c33509c1b3e9efaa8f705a29f;p=bacula%2Fbacula Don't define DLL_IMP_EXP twice in fd_common.h --- diff --git a/bacula/src/plugins/fd/fd_common.h b/bacula/src/plugins/fd/fd_common.h new file mode 100644 index 0000000000..0fedcd6f51 --- /dev/null +++ b/bacula/src/plugins/fd/fd_common.h @@ -0,0 +1,118 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2010-2010 Bacula Systems(R) SA + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can modify it under the terms of + version three of the GNU Affero General Public License as published by the Free + Software Foundation, which is listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + Bacula Systems(R) is a trademark of Bacula Systems SA. + Bacula Enterprise(TM) is a trademark of Bacula Systems SA. + + The licensor of Bacula Enterprise(TM) is Bacula Systems(R) SA, + Rue Galilee 5, 1400 Yverdon-les-Bains, Switzerland. +*/ + +/* You can include this file to your plugin to have + * access to some common tools and utilities provided by Bacula + */ + +#ifndef PCOMMON_H +#define PCOMMON_H + +#define JT_BACKUP 'B' /* Backup Job */ +#define JT_RESTORE 'R' /* Restore Job */ + +#define L_FULL 'F' /* Full backup */ +#define L_INCREMENTAL 'I' /* since last backup */ +#define L_DIFFERENTIAL 'D' /* since last full backup */ + +#ifndef DLL_IMP_EXP +# if defined(BUILDING_DLL) +# define DLL_IMP_EXP __declspec(dllexport) +# elif defined(USING_DLL) +# define DLL_IMP_EXP __declspec(dllimport) +# else +# define DLL_IMP_EXP +# endif +#endif + +DLL_IMP_EXP void *sm_malloc(const char *fname, int lineno, unsigned int nbytes); +DLL_IMP_EXP void sm_free(const char *file, int line, void *fp); +DLL_IMP_EXP void *reallymalloc(const char *fname, int lineno, unsigned int nbytes); +DLL_IMP_EXP void reallyfree(const char *file, int line, void *fp); +DLL_IMP_EXP void sm_check(const char *fname, int lineno, bool dump); + +#ifndef bmalloc +# define bmalloc(s) sm_malloc(__FILE__, __LINE__, (s)) +# define bfree(o) sm_free(__FILE__, __LINE__, (o)) +#endif + +#define SM_CHECK sm_check(__FILE__, __LINE__, false) + +#ifdef malloc +#undef malloc +#undef free +#endif + +#define malloc(s) sm_malloc(__FILE__, __LINE__, (s)) +#define free(o) sm_free(__FILE__, __LINE__, (o)) + +inline void *operator new(size_t size, char const * file, int line) +{ + void *pnew = sm_malloc(file,line, size); + memset((char *)pnew, 0, size); + return pnew; +} + +inline void *operator new[](size_t size, char const * file, int line) +{ + void *pnew = sm_malloc(file, line, size); + memset((char *)pnew, 0, size); + return pnew; +} + +inline void *operator new(size_t size) +{ + void *pnew = sm_malloc(__FILE__, __LINE__, size); + memset((char *)pnew, 0, size); + return pnew; +} + +inline void *operator new[](size_t size) +{ + void *pnew = sm_malloc(__FILE__, __LINE__, size); + memset((char *)pnew, 0, size); + return pnew; +} + +#define new new(__FILE__, __LINE__) + +inline void operator delete(void *buf) +{ + sm_free( __FILE__, __LINE__, buf); +} + +inline void operator delete[] (void *buf) +{ + sm_free(__FILE__, __LINE__, buf); +} + +#define Dmsg(context, level, message, ...) bfuncs->DebugMessage(context, __FILE__, __LINE__, level, message, ##__VA_ARGS__) +#define Jmsg(context, type, message, ...) bfuncs->JobMessage(context, __FILE__, __LINE__, type, 0, message, ##__VA_ARGS__) + +#endif