summaryrefslogtreecommitdiff
path: root/storage/xtradb/include/ut0mem.ic
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2009-11-13 22:26:08 +0100
committerunknown <knielsen@knielsen-hq.org>2009-11-13 22:26:08 +0100
commit898f6f48b79d1f2c334fb559225b2b0fade5ea93 (patch)
tree84df8eecd942b650f172cbd67050ee8984c0d52b /storage/xtradb/include/ut0mem.ic
parent275c0a7f96502b33f763fb9388dcc1c289e4792b (diff)
parent2bde0c5e6d31583e5197e3b513f572a693161f62 (diff)
downloadmariadb-git-898f6f48b79d1f2c334fb559225b2b0fade5ea93.tar.gz
Merge XtraDB 8 into MariaDB.
Diffstat (limited to 'storage/xtradb/include/ut0mem.ic')
-rw-r--r--storage/xtradb/include/ut0mem.ic76
1 files changed, 53 insertions, 23 deletions
diff --git a/storage/xtradb/include/ut0mem.ic b/storage/xtradb/include/ut0mem.ic
index 5078c721706..f36c28f1989 100644
--- a/storage/xtradb/include/ut0mem.ic
+++ b/storage/xtradb/include/ut0mem.ic
@@ -16,7 +16,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
-/***********************************************************************
+/*******************************************************************//**
+@file include/ut0mem.ic
Memory primitives
Created 5/30/1994 Heikki Tuuri
@@ -25,6 +26,12 @@ Created 5/30/1994 Heikki Tuuri
#include "ut0byte.h"
#include "mach0data.h"
+/** Wrapper for memcpy(3). Copy memory area when the source and
+target are not overlapping.
+* @param dest in: copy to
+* @param sour in: copy from
+* @param n in: number of bytes to copy
+* @return dest */
UNIV_INLINE
void*
ut_memcpy(void* dest, const void* sour, ulint n)
@@ -32,6 +39,12 @@ ut_memcpy(void* dest, const void* sour, ulint n)
return(memcpy(dest, sour, n));
}
+/** Wrapper for memmove(3). Copy memory area when the source and
+target are overlapping.
+* @param dest in: copy to
+* @param sour in: copy from
+* @param n in: number of bytes to copy
+* @return dest */
UNIV_INLINE
void*
ut_memmove(void* dest, const void* sour, ulint n)
@@ -39,6 +52,12 @@ ut_memmove(void* dest, const void* sour, ulint n)
return(memmove(dest, sour, n));
}
+/** Wrapper for memcmp(3). Compare memory areas.
+* @param str1 in: first memory block to compare
+* @param str2 in: second memory block to compare
+* @param n in: number of bytes to compare
+* @return negative, 0, or positive if str1 is smaller, equal,
+ or greater than str2, respectively. */
UNIV_INLINE
int
ut_memcmp(const void* str1, const void* str2, ulint n)
@@ -46,6 +65,10 @@ ut_memcmp(const void* str1, const void* str2, ulint n)
return(memcmp(str1, str2, n));
}
+/** Wrapper for strcpy(3). Copy a NUL-terminated string.
+* @param dest in: copy to
+* @param sour in: copy from
+* @return dest */
UNIV_INLINE
char*
ut_strcpy(char* dest, const char* sour)
@@ -53,6 +76,9 @@ ut_strcpy(char* dest, const char* sour)
return(strcpy(dest, sour));
}
+/** Wrapper for strlen(3). Determine the length of a NUL-terminated string.
+* @param str in: string
+* @return length of the string in bytes, excluding the terminating NUL */
UNIV_INLINE
ulint
ut_strlen(const char* str)
@@ -60,6 +86,11 @@ ut_strlen(const char* str)
return(strlen(str));
}
+/** Wrapper for strcmp(3). Compare NUL-terminated strings.
+* @param str1 in: first string to compare
+* @param str2 in: second string to compare
+* @return negative, 0, or positive if str1 is smaller, equal,
+ or greater than str2, respectively. */
UNIV_INLINE
int
ut_strcmp(const char* str1, const char* str2)
@@ -67,15 +98,15 @@ ut_strcmp(const char* str1, const char* str2)
return(strcmp(str1, str2));
}
-/**************************************************************************
-Compute strlen(ut_strcpyq(str, q)). */
+/**********************************************************************//**
+Compute strlen(ut_strcpyq(str, q)).
+@return length of the string when quoted */
UNIV_INLINE
ulint
ut_strlenq(
/*=======*/
- /* out: length of the string when quoted */
- const char* str, /* in: null-terminated string */
- char q) /* in: the quote character */
+ const char* str, /*!< in: null-terminated string */
+ char q) /*!< in: the quote character */
{
ulint len;
@@ -88,20 +119,20 @@ ut_strlenq(
return(len);
}
-/**************************************************************************
-Converts a raw binary data to a '\0'-terminated hex string. The output is
+/**********************************************************************//**
+Converts a raw binary data to a NUL-terminated hex string. The output is
truncated if there is not enough space in "hex", make sure "hex_size" is at
least (2 * raw_size + 1) if you do not want this to happen. Returns the
-actual number of characters written to "hex" (including the '\0'). */
+actual number of characters written to "hex" (including the NUL).
+@return number of chars written */
UNIV_INLINE
ulint
ut_raw_to_hex(
/*==========*/
- /* out: number of chars written */
- const void* raw, /* in: raw data */
- ulint raw_size, /* in: "raw" length in bytes */
- char* hex, /* out: hex string */
- ulint hex_size) /* in: "hex" size in bytes */
+ const void* raw, /*!< in: raw data */
+ ulint raw_size, /*!< in: "raw" length in bytes */
+ char* hex, /*!< out: hex string */
+ ulint hex_size) /*!< in: "hex" size in bytes */
{
#ifdef WORDS_BIGENDIAN
@@ -208,21 +239,20 @@ ut_raw_to_hex(
return(write_bytes);
}
-/***********************************************************************
+/*******************************************************************//**
Adds single quotes to the start and end of string and escapes any quotes
by doubling them. Returns the number of bytes that were written to "buf"
-(including the terminating '\0'). If buf_size is too small then the
-trailing bytes from "str" are discarded. */
+(including the terminating NUL). If buf_size is too small then the
+trailing bytes from "str" are discarded.
+@return number of bytes that were written */
UNIV_INLINE
ulint
ut_str_sql_format(
/*==============*/
- /* out: number of bytes
- that were written */
- const char* str, /* in: string */
- ulint str_len, /* in: string length in bytes */
- char* buf, /* out: output buffer */
- ulint buf_size) /* in: output buffer size
+ const char* str, /*!< in: string */
+ ulint str_len, /*!< in: string length in bytes */
+ char* buf, /*!< out: output buffer */
+ ulint buf_size) /*!< in: output buffer size
in bytes */
{
ulint str_i;