Drizzled Public API Documentation

ut0mem.h
Go to the documentation of this file.
00001 /*****************************************************************************
00002 
00003 Copyright (C) 1994, 2009, Innobase Oy. All Rights Reserved.
00004 
00005 This program is free software; you can redistribute it and/or modify it under
00006 the terms of the GNU General Public License as published by the Free Software
00007 Foundation; version 2 of the License.
00008 
00009 This program is distributed in the hope that it will be useful, but WITHOUT
00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
00012 
00013 You should have received a copy of the GNU General Public License along with
00014 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
00015 St, Fifth Floor, Boston, MA 02110-1301 USA
00016 
00017 *****************************************************************************/
00018 
00019 /*******************************************************************/
00026 #pragma once
00027 #ifndef ut0mem_h
00028 #define ut0mem_h
00029 
00030 #include "univ.i"
00031 #include <string.h>
00032 #include <sys/types.h>
00033 #ifndef UNIV_HOTBACKUP
00034 # include "os0sync.h"
00035 
00039 extern ulint    ut_total_allocated_memory;
00040 
00042 extern os_fast_mutex_t  ut_list_mutex;
00043 #endif /* !UNIV_HOTBACKUP */
00044 
00051 UNIV_INLINE
00052 void*
00053 ut_memcpy(void* dest, const void* sour, ulint n);
00054 
00061 UNIV_INLINE
00062 void*
00063 ut_memmove(void* dest, const void* sour, ulint n);
00064 
00071 UNIV_INLINE
00072 int
00073 ut_memcmp(const void* str1, const void* str2, ulint n);
00074 
00075 /**********************************************************************/
00077 UNIV_INTERN
00078 void
00079 ut_mem_init(void);
00080 /*=============*/
00081 
00082 /**********************************************************************/
00086 UNIV_INTERN
00087 void*
00088 ut_malloc_low(
00089 /*==========*/
00090   ulint n,      
00091   ibool set_to_zero,    
00094   ibool assert_on_error); 
00096 /**********************************************************************/
00100 #ifdef __cplusplus
00101 extern "C"
00102 #endif
00103 UNIV_INTERN
00104 void*
00105 ut_malloc(
00106 /*======*/
00107   ulint n); 
00108 #ifndef UNIV_HOTBACKUP
00109 /**********************************************************************/
00114 UNIV_INTERN
00115 ibool
00116 ut_test_malloc(
00117 /*===========*/
00118   ulint n); 
00119 #endif /* !UNIV_HOTBACKUP */
00120 /**********************************************************************/
00123 #ifdef __cplusplus
00124 extern "C"
00125 #endif
00126 UNIV_INTERN
00127 void
00128 ut_free(
00129 /*====*/
00130   void* ptr);  
00131 #ifndef UNIV_HOTBACKUP
00132 /**********************************************************************/
00157 #ifdef __cplusplus
00158 extern "C"
00159 #endif
00160 UNIV_INTERN
00161 void*
00162 ut_realloc(
00163 /*=======*/
00164   void* ptr,  
00165   ulint size);  
00166 /**********************************************************************/
00168 UNIV_INTERN
00169 void
00170 ut_free_all_mem(void);
00171 /*=================*/
00172 #endif /* !UNIV_HOTBACKUP */
00173 
00178 UNIV_INLINE
00179 char*
00180 ut_strcpy(char* dest, const char* sour);
00181 
00185 UNIV_INLINE
00186 ulint
00187 ut_strlen(const char* str);
00188 
00194 UNIV_INLINE
00195 int
00196 ut_strcmp(const char* str1, const char* str2);
00197 
00198 /**********************************************************************/
00203 UNIV_INTERN
00204 ulint
00205 ut_strlcpy(
00206 /*=======*/
00207   char*   dst,  
00208   const char* src,  
00209   ulint   size);  
00211 /**********************************************************************/
00215 UNIV_INTERN
00216 ulint
00217 ut_strlcpy_rev(
00218 /*===========*/
00219   char*   dst,  
00220   const char* src,  
00221   ulint   size);  
00223 /**********************************************************************/
00226 UNIV_INLINE
00227 ulint
00228 ut_strlenq(
00229 /*=======*/
00230   const char* str,  
00231   char    q); 
00233 /**********************************************************************/
00238 UNIV_INTERN
00239 char*
00240 ut_strcpyq(
00241 /*=======*/
00242   char*   dest, 
00243   char    q,  
00244   const char* src); 
00246 /**********************************************************************/
00251 UNIV_INTERN
00252 char*
00253 ut_memcpyq(
00254 /*=======*/
00255   char*   dest, 
00256   char    q,  
00257   const char* src,  
00258   ulint   len); 
00260 /**********************************************************************/
00264 UNIV_INTERN
00265 ulint
00266 ut_strcount(
00267 /*========*/
00268   const char* s1, 
00269   const char* s2);  
00271 /**********************************************************************/
00275 UNIV_INTERN
00276 char*
00277 ut_strreplace(
00278 /*==========*/
00279   const char* str,  
00280   const char* s1, 
00281   const char* s2);  
00283 /**********************************************************************/
00289 UNIV_INLINE
00290 ulint
00291 ut_raw_to_hex(
00292 /*==========*/
00293   const void* raw,    
00294   ulint   raw_size, 
00295   char*   hex,    
00296   ulint   hex_size);  
00298 /*******************************************************************/
00304 UNIV_INLINE
00305 ulint
00306 ut_str_sql_format(
00307 /*==============*/
00308   const char* str,    
00309   ulint   str_len,  
00310   char*   buf,    
00311   ulint   buf_size);  
00314 #ifndef UNIV_NONINL
00315 #include "ut0mem.ic"
00316 #endif
00317 
00318 #endif