blob: 378b6b796e1bb18f0941083626399a2bc0192409 [file] [log] [blame]
Jeff Thompson47eecfc2013-07-07 22:56:46 -07001/**
2 * @author: Jeff Thompson
3 * See COPYING for copyright and distribution information.
Jeff Thompsonf418fe02013-06-27 17:28:55 -07004 */
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 Thompson6cb56f92013-07-01 15:38:09 -070013#include "../../../config.h"
Jeff Thompsonf418fe02013-06-27 17:28:55 -070014
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19#if HAVE_MEMCPY
20#include <memory.h>
21/**
22 * Use the library version of memcpy.
23 */
24static 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 */
29void 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 */
37static 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 */
42void ndn_memset(unsigned char *dest, int val, unsigned int len);
43#endif
44
45#ifdef __cplusplus
46}
47#endif
48
49#endif
50