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