refactor(sstream): 使用scc_snprintf替换snprintf_
日志格式化函数从snprintf_更改为scc_snprintf以保持一致性, 并调整代码格式以适应新的函数调用方式。 refactor(runtime): 实现平台抽象层(PAL) 引入scc_core_pal.h作为平台抽象层,将内存管理、IO操作和 文件系统功能抽象化。原有的scc_malloc等函数现在通过宏定义 映射到对应的scc_pal_*函数。 feat(runtime): 添加字符串断言检查 在scc_cstring_append_cstr函数中添加Assert(str->data != null) 断言,确保字符串数据指针不为空。 refactor(runtime): 重新组织核心实现文件结构 将原有的cfg.std_impl.c拆分为core_impl.c中的具体实现和 scc_core_pal.h中的抽象接口定义,提供标准库的具体实现。
This commit is contained in:
@@ -32,13 +32,13 @@ static int user_log_handler(logger_t *module, log_level_t level,
|
||||
#endif
|
||||
/* clang-format on */
|
||||
char buf[LOGGER_MAX_BUF_SIZE];
|
||||
int off =
|
||||
snprintf_(buf, sizeof(buf), "%s[%s]%s ", color_code ? color_code : "",
|
||||
level_str, color_code ? ANSI_NONE : "");
|
||||
int off = scc_snprintf(buf, sizeof(buf), "%s[%s]%s ",
|
||||
color_code ? color_code : "", level_str,
|
||||
color_code ? ANSI_NONE : "");
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vsnprintf_(buf + off, sizeof(buf) - off, fmt, args);
|
||||
scc_vsnprintf(buf + off, sizeof(buf) - off, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
log_puts(buf);
|
||||
|
||||
Reference in New Issue
Block a user