feat(core): 添加字符串长度计算函数并优化数据结构定义

- 在 `core_mem.h` 中新增 `smcc_strlen` 函数,用于计算字符串长度
- 调整 `VEC` 宏定义参数,移除冗余的 name 参数,增强结构体声明一致性
- 修改 `cstring_from_cstr` 返回值字段顺序,保持代码风格统一
- 在 `libcore.h` 中增加日志相关宏定义的保护判断,防止重复定义冲突
This commit is contained in:
zzy
2025-11-20 22:26:49 +08:00
parent d1fafa830d
commit f29fd92fdf
10 changed files with 2082 additions and 94 deletions

View File

@@ -36,7 +36,7 @@ static inline cstring_t cstring_from_cstr(const char *s) {
smcc_memcpy(data, s, len);
data[len] = '\0';
return (cstring_t){.data = data, .size = len + 1, .cap = len + 1};
return (cstring_t){.size = len + 1, .cap = len + 1, .data = data};
}
/**