From c3e055092118541b190a12ac29c3f07d6da1e1d5 Mon Sep 17 00:00:00 2001 From: Dmitriy Gerasimov <naeper@demlabs.net> Date: Mon, 8 Feb 2021 21:33:37 +0700 Subject: [PATCH] [+] dap_mempcpy() for platforms where there is no mempcpy() function [-] Removed #include <malloc.h> because its obsolete (stdlib.h recomendded instead of) --- dap-sdk/core/include/dap_common.h | 5 +++++ dap-sdk/core/src/dap_fnmatch.c | 4 +++- dap-sdk/crypto/src/GOST/block_cipher.c | 2 -- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dap-sdk/core/include/dap_common.h b/dap-sdk/core/include/dap_common.h index 4af92ecc78..ffdb565ef9 100755 --- a/dap-sdk/core/include/dap_common.h +++ b/dap-sdk/core/include/dap_common.h @@ -483,6 +483,11 @@ void dap_usleep(time_t a_microseconds); */ char* dap_ctime_r(time_t *a_time, char* a_buf); +static inline void * dap_mempcpy(void * a_dest,const void * a_src,size_t n) +{ + return ((byte_t*) memcpy(a_dest,a_src,n))+n; +} + #ifdef __MINGW32__ diff --git a/dap-sdk/core/src/dap_fnmatch.c b/dap-sdk/core/src/dap_fnmatch.c index f89fa536ef..f9d70717c6 100644 --- a/dap-sdk/core/src/dap_fnmatch.c +++ b/dap-sdk/core/src/dap_fnmatch.c @@ -21,6 +21,8 @@ #include <string.h> #include <stdlib.h> #include <stdbool.h> + +#include "dap_common.h" #include "dap_fnmatch.h" @@ -179,7 +181,7 @@ __wcschrnul (const wchar_t *s, wint_t c) # endif # define STRLEN(S) strlen(S) # define STRCAT(D, S) strcat (D, S) -# define MEMPCPY(D, S, N) mempcpy (D, S, N) +# define MEMPCPY(D, S, N) dap_mempcpy (D, S, N) # define MEMCHR(S, C, N) memchr (S, C, N) # define STRCOLL(S1, S2) strcoll (S1, S2) # define WIDE_CHAR_VERSION 0 diff --git a/dap-sdk/crypto/src/GOST/block_cipher.c b/dap-sdk/crypto/src/GOST/block_cipher.c index 93175427f0..921d5ae9f7 100644 --- a/dap-sdk/crypto/src/GOST/block_cipher.c +++ b/dap-sdk/crypto/src/GOST/block_cipher.c @@ -8,8 +8,6 @@ #include <memory.h> #ifdef __MACH__ #include <sys/malloc.h> -#else -#include <malloc.h> #endif #include <stdlib.h> -- GitLab