Drizzled Public API Documentation

ut0mem.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (C) 1994, 2009, Innobase Oy. 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., 51 Franklin
15 St, Fifth Floor, Boston, MA 02110-1301 USA
16 
17 *****************************************************************************/
18 
19 /*******************************************************************/
26 #pragma once
27 #ifndef ut0mem_h
28 #define ut0mem_h
29 
30 #include "univ.i"
31 #include <string.h>
32 #include <sys/types.h>
33 #ifndef UNIV_HOTBACKUP
34 # include "os0sync.h"
35 
39 extern ulint ut_total_allocated_memory;
40 
43 #endif /* !UNIV_HOTBACKUP */
44 
51 UNIV_INLINE
52 void*
53 ut_memcpy(void* dest, const void* sour, ulint n);
54 
61 UNIV_INLINE
62 void*
63 ut_memmove(void* dest, const void* sour, ulint n);
64 
71 UNIV_INLINE
72 int
73 ut_memcmp(const void* str1, const void* str2, ulint n);
74 
75 /**********************************************************************/
77 UNIV_INTERN
78 void
79 ut_mem_init(void);
80 /*=============*/
81 
82 /**********************************************************************/
86 UNIV_INTERN
87 void*
89 /*==========*/
90  ulint n,
91  ibool set_to_zero,
94  ibool assert_on_error);
96 /**********************************************************************/
100 #ifdef __cplusplus
101 extern "C"
102 #endif
103 UNIV_INTERN
104 void*
105 ut_malloc(
106 /*======*/
107  ulint n);
108 #ifndef UNIV_HOTBACKUP
109 /**********************************************************************/
114 UNIV_INTERN
115 ibool
117 /*===========*/
118  ulint n);
119 #endif /* !UNIV_HOTBACKUP */
120 /**********************************************************************/
123 #ifdef __cplusplus
124 extern "C"
125 #endif
126 UNIV_INTERN
127 void
128 ut_free(
129 /*====*/
130  void* ptr);
131 #ifndef UNIV_HOTBACKUP
132 /**********************************************************************/
157 #ifdef __cplusplus
158 extern "C"
159 #endif
160 UNIV_INTERN
161 void*
162 ut_realloc(
163 /*=======*/
164  void* ptr,
165  ulint size);
166 /**********************************************************************/
168 UNIV_INTERN
169 void
170 ut_free_all_mem(void);
171 /*=================*/
172 #endif /* !UNIV_HOTBACKUP */
173 
178 UNIV_INLINE
179 char*
180 ut_strcpy(char* dest, const char* sour);
181 
185 UNIV_INLINE
186 ulint
187 ut_strlen(const char* str);
188 
194 UNIV_INLINE
195 int
196 ut_strcmp(const char* str1, const char* str2);
197 
198 /**********************************************************************/
203 UNIV_INTERN
204 ulint
205 ut_strlcpy(
206 /*=======*/
207  char* dst,
208  const char* src,
209  ulint size);
211 /**********************************************************************/
215 UNIV_INTERN
216 ulint
218 /*===========*/
219  char* dst,
220  const char* src,
221  ulint size);
223 /**********************************************************************/
226 UNIV_INLINE
227 ulint
228 ut_strlenq(
229 /*=======*/
230  const char* str,
231  char q);
233 /**********************************************************************/
238 UNIV_INTERN
239 char*
240 ut_strcpyq(
241 /*=======*/
242  char* dest,
243  char q,
244  const char* src);
246 /**********************************************************************/
251 UNIV_INTERN
252 char*
253 ut_memcpyq(
254 /*=======*/
255  char* dest,
256  char q,
257  const char* src,
258  ulint len);
260 /**********************************************************************/
264 UNIV_INTERN
265 ulint
267 /*========*/
268  const char* s1,
269  const char* s2);
271 /**********************************************************************/
275 UNIV_INTERN
276 char*
278 /*==========*/
279  const char* str,
280  const char* s1,
281  const char* s2);
283 /**********************************************************************/
289 UNIV_INLINE
290 ulint
292 /*==========*/
293  const void* raw,
294  ulint raw_size,
295  char* hex,
296  ulint hex_size);
298 /*******************************************************************/
304 UNIV_INLINE
305 ulint
307 /*==============*/
308  const char* str,
309  ulint str_len,
310  char* buf,
311  ulint buf_size);
314 #ifndef UNIV_NONINL
315 #include "ut0mem.ic"
316 #endif
317 
318 #endif
UNIV_INLINE ulint ut_strlenq(const char *str, char q)
UNIV_INTERN void * ut_realloc(void *ptr, ulint size)
Definition: ut0mem.cc:355
UNIV_INLINE void * ut_memmove(void *dest, const void *sour, ulint n)
pthread_mutex_t os_fast_mutex_t
Definition: os0sync.h:50
UNIV_INTERN char * ut_strcpyq(char *dest, char q, const char *src)
Definition: ut0mem.cc:497
UNIV_INLINE void * ut_memcpy(void *dest, const void *sour, ulint n)
ulint ut_total_allocated_memory
Definition: ut0mem.cc:45
UNIV_INTERN void * ut_malloc(ulint n)
Definition: ut0mem.cc:235
UNIV_INTERN void ut_free_all_mem(void)
Definition: ut0mem.cc:411
os_fast_mutex_t ut_list_mutex
Definition: ut0mem.cc:48
UNIV_INTERN void * ut_malloc_low(ulint n, ibool set_to_zero, ibool assert_on_error)
Definition: ut0mem.cc:93
UNIV_INTERN char * ut_strreplace(const char *str, const char *s1, const char *s2)
Definition: ut0mem.cc:578
UNIV_INTERN ulint ut_strcount(const char *s1, const char *s2)
Definition: ut0mem.cc:544
UNIV_INTERN ulint ut_strlcpy(char *dst, const char *src, ulint size)
Definition: ut0mem.cc:449
UNIV_INTERN ibool ut_test_malloc(ulint n)
Definition: ut0mem.cc:254
UNIV_INLINE ulint ut_str_sql_format(const char *str, ulint str_len, char *buf, ulint buf_size)
UNIV_INTERN void ut_mem_init(void)
Definition: ut0mem.cc:77
UNIV_INTERN void ut_free(void *ptr)
Definition: ut0mem.cc:294
UNIV_INTERN char * ut_memcpyq(char *dest, char q, const char *src, ulint len)
Definition: ut0mem.cc:519
UNIV_INLINE char * ut_strcpy(char *dest, const char *sour)
UNIV_INLINE ulint ut_raw_to_hex(const void *raw, ulint raw_size, char *hex, ulint hex_size)
UNIV_INLINE int ut_memcmp(const void *str1, const void *str2, ulint n)
UNIV_INTERN ulint ut_strlcpy_rev(char *dst, const char *src, ulint size)
Definition: ut0mem.cc:473
UNIV_INLINE int ut_strcmp(const char *str1, const char *str2)
UNIV_INLINE ulint ut_strlen(const char *str)