1
by brian
clean slate |
1 |
/***********************************************************************
|
2 |
Memory primitives |
|
3 |
||
4 |
(c) 1994, 1995 Innobase Oy |
|
5 |
||
6 |
Created 5/30/1994 Heikki Tuuri |
|
7 |
************************************************************************/
|
|
8 |
||
9 |
UNIV_INLINE
|
|
10 |
void* |
|
11 |
ut_memcpy(void* dest, const void* sour, ulint n) |
|
12 |
{
|
|
13 |
return(memcpy(dest, sour, n)); |
|
14 |
}
|
|
15 |
||
16 |
UNIV_INLINE
|
|
17 |
void* |
|
18 |
ut_memmove(void* dest, const void* sour, ulint n) |
|
19 |
{
|
|
20 |
return(memmove(dest, sour, n)); |
|
21 |
}
|
|
22 |
||
23 |
UNIV_INLINE
|
|
24 |
int
|
|
25 |
ut_memcmp(const void* str1, const void* str2, ulint n) |
|
26 |
{
|
|
27 |
return(memcmp(str1, str2, n)); |
|
28 |
}
|
|
29 |
||
30 |
UNIV_INLINE
|
|
31 |
char* |
|
32 |
ut_strcpy(char* dest, const char* sour) |
|
33 |
{
|
|
34 |
return(strcpy(dest, sour)); |
|
35 |
}
|
|
36 |
||
37 |
UNIV_INLINE
|
|
38 |
ulint
|
|
39 |
ut_strlen(const char* str) |
|
40 |
{
|
|
41 |
return(strlen(str)); |
|
42 |
}
|
|
43 |
||
44 |
UNIV_INLINE
|
|
45 |
int
|
|
46 |
ut_strcmp(const void* str1, const void* str2) |
|
47 |
{
|
|
48 |
return(strcmp((const char*)str1, (const char*)str2)); |
|
49 |
}
|
|
50 |
||
51 |
/**************************************************************************
|
|
52 |
Compute strlen(ut_strcpyq(str, q)). */ |
|
53 |
UNIV_INLINE
|
|
54 |
ulint
|
|
55 |
ut_strlenq( |
|
56 |
/*=======*/
|
|
57 |
/* out: length of the string when quoted */ |
|
58 |
const char* str, /* in: null-terminated string */ |
|
59 |
char q) /* in: the quote character */ |
|
60 |
{
|
|
61 |
ulint len; |
|
62 |
||
63 |
for (len = 0; *str; len++, str++) { |
|
64 |
if (*str == q) { |
|
65 |
len++; |
|
66 |
}
|
|
67 |
}
|
|
68 |
||
69 |
return(len); |
|
70 |
}
|