00001 /* -*- c++ -*- */ 00002 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 00003 00004 // O S C L _ M E M _ B A S I C _ F U N C T I O N S 00005 00006 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 00007 00018 #ifndef OSCL_MEM_BASIC_FUNCTIONS_H 00019 #define OSCL_MEM_BASIC_FUNCTIONS_H 00020 00021 #ifndef OSCL_BASE_H_INCLUDED 00022 #include "oscl_base.h" 00023 #endif 00024 00025 /* 00026 * Note: the public oscl_malloc call has been deprecated. This 00027 * function is for internal use by Oscl code only. Higher level 00028 * code should include "oscl_mem.h" and use OSCL_MALLOC. 00029 * 00030 * Allocates a memory block. 00031 * 00032 * @param count number of bytes to allocate 00033 * 00034 * @return a void pointer to the allocated space, or NULL if there is insufficient 00035 * memory available. 00036 */ 00037 OSCL_COND_IMPORT_REF void* _oscl_malloc(int32 count); 00038 00039 /* 00040 * Note: the public oscl_calloc call has been deprecated. This 00041 * function is for internal use by Oscl code only. Higher level 00042 * code should include "oscl_mem.h" and use OSCL_CALLOC. 00043 * 00044 * 00045 * Allocates a memory block and fills with zeros. 00046 * 00047 * 00048 * @param nelems number of elements of size bytes to allocate. 00049 * @param size the size in bytes of each element 00050 * 00051 * the total space allocated = nelems * size bytes. 00052 * 00053 * @return a void pointer to the allocated space, or NULL if there is insufficient 00054 * memory available. 00055 */ 00056 OSCL_COND_IMPORT_REF void* _oscl_calloc(int32 nelems, int32 size); 00057 00058 00059 /* 00060 * Note: the public oscl_realloc call has been deprecated. This 00061 * function is for internal use by Oscl code only. Higher level 00062 * code should include "oscl_mem.h" and use OSCL_REALLOC. 00063 * 00064 * 00065 * Reallocates a memory block 00066 * If src is NULL, realloc behaves the same way as oscl_malloc and allocates a new 00067 * block of size count. 00068 * 00069 * @param src pointer to previously allocated memory block 00070 * @param count number of bytes to allocate 00071 * 00072 * @return a void pointer to the reallocated (and possibly moved) memory block. The 00073 * return value is NULL if the size is zero and the buffer argument is not NULL, 00074 * or if there is not enough available memory to expand the block to the given 00075 * size. 00076 */ 00077 OSCL_COND_IMPORT_REF void* _oscl_realloc(void* src, int32 count); 00078 00079 /* 00080 * Note: the public oscl_free call has been deprecated. This 00081 * function is for internal use by Oscl code only. Higher level 00082 * code should include "oscl_mem.h" and use OSCL_FREE. 00083 * 00084 * 00085 * Deallocates or frees a memory block 00086 * 00087 * @param src pointer to previously allocated memory block 00088 * 00089 * @return 00090 */ 00091 OSCL_COND_IMPORT_REF void _oscl_free(void* src); 00092 00106 OSCL_COND_IMPORT_REF void* oscl_memcpy(void* dest, const void* src, uint32 count); 00107 00121 OSCL_COND_IMPORT_REF void* oscl_memmove(void* dest, const void* src, uint32 count); 00122 00133 OSCL_COND_IMPORT_REF void* oscl_memmove32(void* dest, const void* src, uint32 count); 00134 00144 OSCL_COND_IMPORT_REF void* oscl_memset(void* dest, uint8 val, uint32 count); 00145 00157 OSCL_COND_IMPORT_REF int oscl_memcmp(const void* buf1, const void* buf2, uint32 count); 00158 00159 00160 #if (!OSCL_DISABLE_INLINES) 00161 #include "oscl_mem_basic_functions.inl" 00162 #endif 00163 00164 #endif 00165