summaryrefslogtreecommitdiffstats
path: root/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/core/shared/utils/bh_common.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-09 13:19:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-09 13:19:22 +0000
commitc21c3b0befeb46a51b6bf3758ffa30813bea0ff0 (patch)
tree9754ff1ca740f6346cf8483ec915d4054bc5da2d /fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/core/shared/utils/bh_common.h
parentAdding upstream version 1.43.2. (diff)
downloadnetdata-c21c3b0befeb46a51b6bf3758ffa30813bea0ff0.tar.xz
netdata-c21c3b0befeb46a51b6bf3758ffa30813bea0ff0.zip
Adding upstream version 1.44.3.upstream/1.44.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/core/shared/utils/bh_common.h')
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/core/shared/utils/bh_common.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/core/shared/utils/bh_common.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/core/shared/utils/bh_common.h
new file mode 100644
index 000000000..edb962eb1
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/core/shared/utils/bh_common.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+#ifndef _BH_COMMON_H
+#define _BH_COMMON_H
+
+#include "bh_platform.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define bh_memcpy_s(dest, dlen, src, slen) \
+ do { \
+ int _ret = slen == 0 ? 0 : b_memcpy_s(dest, dlen, src, slen); \
+ (void)_ret; \
+ bh_assert(_ret == 0); \
+ } while (0)
+
+#define bh_memcpy_wa(dest, dlen, src, slen) \
+ do { \
+ int _ret = slen == 0 ? 0 : b_memcpy_wa(dest, dlen, src, slen); \
+ (void)_ret; \
+ bh_assert(_ret == 0); \
+ } while (0)
+
+#define bh_memmove_s(dest, dlen, src, slen) \
+ do { \
+ int _ret = slen == 0 ? 0 : b_memmove_s(dest, dlen, src, slen); \
+ (void)_ret; \
+ bh_assert(_ret == 0); \
+ } while (0)
+
+#define bh_strcat_s(dest, dlen, src) \
+ do { \
+ int _ret = b_strcat_s(dest, dlen, src); \
+ (void)_ret; \
+ bh_assert(_ret == 0); \
+ } while (0)
+
+#define bh_strcpy_s(dest, dlen, src) \
+ do { \
+ int _ret = b_strcpy_s(dest, dlen, src); \
+ (void)_ret; \
+ bh_assert(_ret == 0); \
+ } while (0)
+
+int
+b_memcpy_s(void *s1, unsigned int s1max, const void *s2, unsigned int n);
+int
+b_memcpy_wa(void *s1, unsigned int s1max, const void *s2, unsigned int n);
+int
+b_memmove_s(void *s1, unsigned int s1max, const void *s2, unsigned int n);
+int
+b_strcat_s(char *s1, unsigned int s1max, const char *s2);
+int
+b_strcpy_s(char *s1, unsigned int s1max, const char *s2);
+
+/* strdup with string allocated by BH_MALLOC */
+char *
+bh_strdup(const char *s);
+
+/* strdup with string allocated by WA_MALLOC */
+char *
+wa_strdup(const char *s);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif