2 Bacula® - The Network Backup Solution
4 Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
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 redistribute it and/or
9 modify it under the terms of version two of the GNU General Public
10 License as published by the Free Software Foundation and included
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 Bacula® is a registered trademark of John Walker.
24 The licensor of Bacula is the Free Software Foundation Europe
25 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26 Switzerland, email:ftf@fsfeurope.org.
29 * Memory Pool prototypes
42 #define get_pool_memory(pool) sm_get_pool_memory(__FILE__, __LINE__, pool)
43 extern POOLMEM *sm_get_pool_memory(const char *file, int line, int pool);
45 #define get_memory(size) sm_get_memory(__FILE__, __LINE__, size)
46 extern POOLMEM *sm_get_memory(const char *fname, int line, int32_t size);
48 #define sizeof_pool_memory(buf) sm_sizeof_pool_memory(__FILE__, __LINE__, buf)
49 extern int32_t sm_sizeof_pool_memory(const char *fname, int line, POOLMEM *buf);
51 #define realloc_pool_memory(buf,size) sm_realloc_pool_memory(__FILE__, __LINE__, buf, size)
52 extern POOLMEM *sm_realloc_pool_memory(const char *fname, int line, POOLMEM *buf, int32_t size);
54 #define check_pool_memory_size(buf,size) sm_check_pool_memory_size(__FILE__, __LINE__, buf, size)
55 extern POOLMEM *sm_check_pool_memory_size(const char *fname, int line, POOLMEM *buf, int32_t size);
57 #define free_pool_memory(x) sm_free_pool_memory(__FILE__, __LINE__, x)
58 #define free_memory(x) sm_free_pool_memory(__FILE__, __LINE__, x)
59 extern void sm_free_pool_memory(const char *fname, int line, POOLMEM *buf);
64 extern POOLMEM *get_pool_memory(int pool);
65 extern POOLMEM *get_memory(int32_t size);
66 extern int32_t sizeof_pool_memory(POOLMEM *buf);
67 extern POOLMEM *realloc_pool_memory(POOLMEM *buf, int32_t size);
68 extern POOLMEM *check_pool_memory_size(POOLMEM *buf, int32_t size);
69 #define free_memory(x) free_pool_memory(x)
70 extern void free_pool_memory(POOLMEM *buf);
74 extern void garbage_collect_memory_pool();
75 extern void close_memory_pool();
76 extern void print_memory_pool_stats();
80 #define PM_NOPOOL 0 /* nonpooled memory */
81 #define PM_NAME 1 /* Bacula name */
82 #define PM_FNAME 2 /* file name buffer */
83 #define PM_MESSAGE 3 /* daemon message */
84 #define PM_EMSG 4 /* error message */
85 #define PM_MAX PM_EMSG /* Number of types */
90 POOL_MEM() { mem = get_pool_memory(PM_NAME); *mem = 0; }
91 POOL_MEM(int pool) { mem = get_pool_memory(pool); *mem = 0; }
92 ~POOL_MEM() { free_pool_memory(mem); mem = NULL; }
93 char *c_str() const { return mem; }
94 POOLMEM *&addr() { return mem; }
95 int size() const { return sizeof_pool_memory(mem); }
96 char *check_size(int32_t size) {
97 mem = check_pool_memory_size(mem, size);
101 void realloc_pm(int32_t size);
102 int strcpy(const char *str);
103 int strcat(const char *str);
106 int pm_strcat(POOLMEM **pm, const char *str);
107 int pm_strcat(POOLMEM *&pm, const char *str);
108 int pm_strcat(POOL_MEM &pm, const char *str);
109 int pm_strcat(POOLMEM *&pm, POOL_MEM &str);
110 int pm_strcpy(POOLMEM **pm, const char *str);
111 int pm_strcpy(POOLMEM *&pm, const char *str);
112 int pm_strcpy(POOL_MEM &pm, const char *str);
113 int pm_strcpy(POOLMEM *&pm, POOL_MEM &str);