Jeff Thompson | 47eecfc | 2013-07-07 22:56:46 -0700 | [diff] [blame^] | 1 | /** |
| 2 | * @author: Jeff Thompson |
| 3 | * See COPYING for copyright and distribution information. |
Jeff Thompson | f418fe0 | 2013-06-27 17:28:55 -0700 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | /* |
| 7 | * Based on HAVE_MEMCPY and HAVE_MEMSET in config.h, use the library version or a local implementation of memcpy and memset. |
| 8 | */ |
| 9 | |
| 10 | #ifndef NDN_MEMORY_H |
| 11 | #define NDN_MEMORY_H |
| 12 | |
Jeff Thompson | 6cb56f9 | 2013-07-01 15:38:09 -0700 | [diff] [blame] | 13 | #include "../../../config.h" |
Jeff Thompson | f418fe0 | 2013-06-27 17:28:55 -0700 | [diff] [blame] | 14 | |
| 15 | #ifdef __cplusplus |
| 16 | extern "C" { |
| 17 | #endif |
| 18 | |
| 19 | #if HAVE_MEMCPY |
| 20 | #include <memory.h> |
| 21 | /** |
| 22 | * Use the library version of memcpy. |
| 23 | */ |
| 24 | static inline void ndn_memcpy(unsigned char *dest, unsigned char *src, unsigned int len) { memcpy(dest, src, len); } |
| 25 | #else |
| 26 | /** |
| 27 | * Use a local implementation of memcpy instead of the library version. |
| 28 | */ |
| 29 | void ndn_memcpy(unsigned char *dest, unsigned char *src, unsigned int len); |
| 30 | #endif |
| 31 | |
| 32 | #if HAVE_MEMSET |
| 33 | #include <memory.h> |
| 34 | /** |
| 35 | * Use the library version of memset. |
| 36 | */ |
| 37 | static inline void ndn_memset(unsigned char *dest, int val, unsigned int len) { memset(dest, val, len); } |
| 38 | #else |
| 39 | /** |
| 40 | * Use a local implementation of memset instead of the library version. |
| 41 | */ |
| 42 | void ndn_memset(unsigned char *dest, int val, unsigned int len); |
| 43 | #endif |
| 44 | |
| 45 | #ifdef __cplusplus |
| 46 | } |
| 47 | #endif |
| 48 | |
| 49 | #endif |
| 50 | |