InnoDB Plugin  1.0
ut0mem.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 1994, 2011, Oracle and/or its affiliates. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free Software
7 Foundation; version 2 of the License.
8 
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc.,
15 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
16 
17 *****************************************************************************/
18 
19 /*******************************************************************/
26 #ifndef ut0mem_h
27 #define ut0mem_h
28 
29 #include "univ.i"
30 #include <string.h>
31 #ifndef UNIV_HOTBACKUP
32 # include "os0sync.h"
33 
37 extern ulint ut_total_allocated_memory;
38 
41 #endif /* !UNIV_HOTBACKUP */
42 
49 UNIV_INLINE
50 void*
51 ut_memcpy(void* dest, const void* sour, ulint n);
52 
59 UNIV_INLINE
60 void*
61 ut_memmove(void* dest, const void* sour, ulint n);
62 
69 UNIV_INLINE
70 int
71 ut_memcmp(const void* str1, const void* str2, ulint n);
72 
73 /**********************************************************************/
75 UNIV_INTERN
76 void
77 ut_mem_init(void);
78 /*=============*/
79 
80 /**********************************************************************/
83 UNIV_INTERN
84 void*
86 /*==========*/
87  ulint n,
88  ibool assert_on_error)
90  __attribute__((malloc));
91 /**********************************************************************/
93 #define ut_malloc(n) ut_malloc_low(n, TRUE)
94 /**********************************************************************/
97 UNIV_INTERN
98 void
99 ut_free(
100 /*====*/
101  void* ptr);
102 #ifndef UNIV_HOTBACKUP
103 /**********************************************************************/
128 UNIV_INTERN
129 void*
130 ut_realloc(
131 /*=======*/
132  void* ptr,
133  ulint size);
134 /**********************************************************************/
136 UNIV_INTERN
137 void
138 ut_free_all_mem(void);
139 /*=================*/
140 #endif /* !UNIV_HOTBACKUP */
141 
146 UNIV_INLINE
147 char*
148 ut_strcpy(char* dest, const char* sour);
149 
153 UNIV_INLINE
154 ulint
155 ut_strlen(const char* str);
156 
162 UNIV_INLINE
163 int
164 ut_strcmp(const char* str1, const char* str2);
165 
166 /**********************************************************************/
171 UNIV_INTERN
172 ulint
173 ut_strlcpy(
174 /*=======*/
175  char* dst,
176  const char* src,
177  ulint size);
179 /**********************************************************************/
183 UNIV_INTERN
184 ulint
186 /*===========*/
187  char* dst,
188  const char* src,
189  ulint size);
191 /**********************************************************************/
195 UNIV_INTERN
196 ulint
198 /*========*/
199  const char* s1,
200  const char* s2);
202 /**********************************************************************/
206 UNIV_INTERN
207 char*
209 /*==========*/
210  const char* str,
211  const char* s1,
212  const char* s2);
214 /********************************************************************
215 Concatenate 3 strings.*/
216 
217 char*
218 ut_str3cat(
219 /*=======*/
220  /* out, own: concatenated string, must be
221  freed with mem_free() */
222  const char* s1, /* in: string 1 */
223  const char* s2, /* in: string 2 */
224  const char* s3); /* in: string 3 */
225 
226 /**********************************************************************/
232 UNIV_INLINE
233 ulint
235 /*==========*/
236  const void* raw,
237  ulint raw_size,
238  char* hex,
239  ulint hex_size);
241 /*******************************************************************/
247 UNIV_INLINE
248 ulint
250 /*==============*/
251  const char* str,
252  ulint str_len,
253  char* buf,
254  ulint buf_size);
257 #ifndef UNIV_NONINL
258 #include "ut0mem.ic"
259 #endif
260 
261 #endif