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:
zzy
2026-03-02 21:21:17 +08:00
parent beb0b19026
commit 2c4b803058
7 changed files with 222 additions and 103 deletions

View File

@@ -9,9 +9,11 @@ extern logger_t __scc_usr_log;
#define SCC_POS_LOG(level, pos, fmt, ...) \
do { \
char _full_msg[LOGGER_MAX_BUF_SIZE]; \
int _n = snprintf_(_full_msg, sizeof(_full_msg), \
"%s:%lu:%lu: ", (pos).name, (pos).line, (pos).col); \
snprintf_(_full_msg + _n, sizeof(_full_msg) - _n, fmt, ##__VA_ARGS__); \
int _n = \
scc_snprintf(_full_msg, sizeof(_full_msg), \
"%s:%zu:%zu: ", (pos).name, (pos).line, (pos).col); \
scc_snprintf(_full_msg + _n, sizeof(_full_msg) - _n, fmt, \
##__VA_ARGS__); \
__scc_usr_log.handler(&__scc_usr_log, level, null, 0, null, "%s", \
_full_msg); \
} while (0)