ZSTD_ prefix mem{cpy,move,set},malloc,calloc,free

This commit is contained in:
Nick Terrell
2020-08-26 12:26:03 -07:00
parent a686d306d2
commit c465f24457
25 changed files with 192 additions and 178 deletions
+20 -6
View File
@@ -9,9 +9,9 @@
*/
/* Need:
* memcpy()
* memset()
* memmove()
* ZSTD_memcpy()
* ZSTD_memset()
* ZSTD_memmove()
* BYTE
* S16
* U16
@@ -29,6 +29,16 @@
#include <stddef.h>
#include <string.h>
#if defined(__GNUC__) && __GNUC__ >= 4
# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
#else
# define ZSTD_memcpy(d,s,l) memcpy((d),(s),(l))
# define ZSTD_memmove(d,s,l) memmove((d),(s),(l))
# define ZSTD_memset(p,v,l) memset((p),(v),(l))
#endif
/*-**************************************************************
* Basic Types
*****************************************************************/
@@ -66,9 +76,9 @@
#endif /* ZSTD_DEPS_COMMON */
/* Need:
* malloc()
* free()
* calloc()
* ZSTD_malloc()
* ZSTD_free()
* ZSTD_calloc()
*/
#ifdef ZSTD_DEPS_NEED_MALLOC
#ifndef ZSTD_DEPS_MALLOC
@@ -76,6 +86,10 @@
#include <stdlib.h>
#define ZSTD_malloc(s) malloc(s)
#define ZSTD_calloc(n,s) calloc((n), (s))
#define ZSTD_free(p) free((p))
#endif /* ZSTD_DEPS_MALLOC */
#endif /* ZSTD_DEPS_NEED_MALLOC */