]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/cmemory.h
2 ******************************************************************************
4 * Copyright (C) 1997-2003, International Business Machines
5 * Corporation and others. All Rights Reserved.
7 ******************************************************************************
11 * Contains stdlib.h/string.h memory functions
13 * @author Bertrand A. Damiba
15 * Modification History:
17 * Date Name Description
18 * 6/20/98 Bertrand Created.
19 * 05/03/99 stephen Changed from functions to macros.
21 ******************************************************************************
27 #include "unicode/utypes.h"
32 #define uprv_memcpy(dst, src, size) U_STANDARD_CPP_NAMESPACE memcpy(dst, src, size)
33 #define uprv_memmove(dst, src, size) U_STANDARD_CPP_NAMESPACE memmove(dst, src, size)
34 #define uprv_memset(buffer, mark, size) U_STANDARD_CPP_NAMESPACE memset(buffer, mark, size)
35 #define uprv_memcmp(buffer1, buffer2, size) U_STANDARD_CPP_NAMESPACE memcmp(buffer1, buffer2,size)
37 U_CAPI
void * U_EXPORT2
38 uprv_malloc(size_t s
);
40 U_CAPI
void * U_EXPORT2
41 uprv_realloc(void *mem
, size_t size
);
47 * This should align the memory properly on any machine.
48 * This is very useful for the safeClone functions.
57 * Get the amount of bytes that a pointer is off by from
58 * the previous aligned pointer
60 #define U_ALIGNMENT_OFFSET(ptr) (((size_t)ptr) & (sizeof(UAlignedMemory) - 1))
63 * Get the amount of bytes to add to a pointer
64 * in order to get the next aligned address
66 #define U_ALIGNMENT_OFFSET_UP(ptr) (sizeof(UAlignedMemory) - U_ALIGNMENT_OFFSET(ptr))
69 * Indicate whether the ICU allocation functions have been used.
70 * This is used to determine whether ICU is in an initial, unused state.
76 * Heap clean up function, called from u_cleanup()
77 * Clears any user heap functions from u_setMemoryFunctions()
78 * Does NOT deallocate any remaining allocated memory.
81 cmemory_cleanup(void);