b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | /****************************************************************************** |
| 2 | *(C) Copyright 2008 Marvell International Ltd. |
| 3 | * All Rights Reserved |
| 4 | ******************************************************************************/ |
| 5 | /***************************************************************************** |
| 6 | * Utility Library |
| 7 | * |
| 8 | * Memory-allocation utilities header file |
| 9 | * |
| 10 | *****************************************************************************/ |
| 11 | |
| 12 | #ifndef _UTL_MALLOC_INCLUDED |
| 13 | #define _UTL_MALLOC_INCLUDED |
| 14 | |
| 15 | #include <stdlib.h> |
| 16 | |
| 17 | #include "utlTypes.h" |
| 18 | #include "utlError.h" |
| 19 | |
| 20 | |
| 21 | /*--- Macros ----------------------------------------------------------------*/ |
| 22 | |
| 23 | #define utlFree(buf_p) utlDoFree(utlHERE, (void *)buf_p), buf_p = NULL |
| 24 | #define utlFreeConst(buf_p) utlDoFree(utlHERE, (void *)buf_p) |
| 25 | #define utlMalloc(siz) utlDoMalloc(utlHERE, siz) |
| 26 | #define utlRealloc(buf_p, siz) utlDoRealloc(utlHERE, (void *)buf_p, siz) |
| 27 | #define utlCalloc(number_of, siz) utlDoCalloc(utlHERE, number_of, siz) |
| 28 | |
| 29 | |
| 30 | /*--- Prototypes ------------------------------------------------------------*/ |
| 31 | |
| 32 | #ifdef __cplusplus |
| 33 | extern "C" { |
| 34 | #endif |
| 35 | |
| 36 | extern void utlDoFree(utlHERE_DECLARATION, void *buf_p); |
| 37 | extern void *utlDoMalloc(utlHERE_DECLARATION, size_t siz); |
| 38 | extern void *utlDoRealloc(utlHERE_DECLARATION, void *buf_p, |
| 39 | size_t siz); |
| 40 | extern void *utlDoCalloc(utlHERE_DECLARATION, size_t number_of, |
| 41 | size_t siz); |
| 42 | |
| 43 | #ifdef __cplusplus |
| 44 | } |
| 45 | #endif |
| 46 | |
| 47 | #endif /* _UTL_MALLOC_INCLUDED */ |
| 48 | |