提交 ff77af3b 编写于 作者: M MapleStory

allow other static linked libraries call musl hilog adapter

Signed-off-by: NMapleStory <zengzhi5@huawei.com>
上级 6931665e
...@@ -91,7 +91,8 @@ static int SendMessage(HilogMsg *header, const char *tag, uint16_t tagLen, const ...@@ -91,7 +91,8 @@ static int SendMessage(HilogMsg *header, const char *tag, uint16_t tagLen, const
return ret; return ret;
} }
static int HiLogAdapterPrintArgs( HILOG_LOCAL_API
int HiLogAdapterPrintArgs(
const LogType type, const LogLevel level, const unsigned int domain, const char *tag, const char *fmt, va_list ap) const LogType type, const LogLevel level, const unsigned int domain, const char *tag, const char *fmt, va_list ap)
{ {
char buf[MAX_LOG_LEN] = {0}; char buf[MAX_LOG_LEN] = {0};
...@@ -112,6 +113,7 @@ static int HiLogAdapterPrintArgs( ...@@ -112,6 +113,7 @@ static int HiLogAdapterPrintArgs(
return SendMessage(&header, tag, tagLen + 1, buf, logLen + 1); return SendMessage(&header, tag, tagLen + 1, buf, logLen + 1);
} }
HILOG_LOCAL_API
int HiLogAdapterPrint(LogType type, LogLevel level, unsigned int domain, const char *tag, const char *fmt, ...) int HiLogAdapterPrint(LogType type, LogLevel level, unsigned int domain, const char *tag, const char *fmt, ...)
{ {
if (!HiLogAdapterIsLoggable(domain, tag, level)) { if (!HiLogAdapterIsLoggable(domain, tag, level)) {
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include <stdio.h> #include <stdio.h>
#include "malloc_impl.h" #include "malloc_impl.h"
/* Do not malloc in vsnprintf, thus the log api can be called inside signal handler*/
#define HILOG_PROHIBIT_ALLOCATION
/* Define the max length of the string */ /* Define the max length of the string */
#ifndef SECUREC_STRING_MAX_LEN #ifndef SECUREC_STRING_MAX_LEN
...@@ -137,8 +139,8 @@ typedef enum { ...@@ -137,8 +139,8 @@ typedef enum {
#endif #endif
#else #else
#define SECUREC_MALLOC(x) (nullptr) #define SECUREC_MALLOC(x) (NULL)
#define SECUREC_FREE(x) { printf("Malloc is not allowed, so free should not be possible to execute!"); std::abort(); } #define SECUREC_FREE(x) {}
#endif #endif
#if (defined(_WIN32) || defined(_WIN64) || defined(_MSC_VER)) || defined(__ARMCC_VERSION) #if (defined(_WIN32) || defined(_WIN64) || defined(_MSC_VER)) || defined(__ARMCC_VERSION)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册