feat(core): rename string and stream functions for clarity

- Rename `cstring_push` to `cstring_append_ch` and `cstring_push_cstr` to `cstring_append_cstr` for consistent naming with new `cstring_append` function
- Update all callers in lexer and tests to use new function names
- Rename stream `destroy` method to `drop` for consistency with resource management conventions
- Fix potential overflow in string capacity calculation by adjusting growth logic
This commit is contained in:
zzy
2025-12-09 18:04:53 +08:00
parent 36bff64a91
commit 186602a301
5 changed files with 28 additions and 16 deletions

View File

@@ -46,7 +46,7 @@ struct core_probe_stream {
cbool (*is_at_end)(core_probe_stream_t *stream);
/// @brief 销毁流并释放资源
void (*destroy)(core_probe_stream_t *stream);
void (*drop)(core_probe_stream_t *stream);
};
static inline int core_probe_stream_consume(core_probe_stream_t *self) {
@@ -86,8 +86,8 @@ static inline cbool core_probe_stream_has_more(core_probe_stream_t *self) {
return !self->is_at_end(self);
}
static inline void core_probe_stream_destroy(core_probe_stream_t *self) {
self->destroy(self);
static inline void core_probe_stream_drop(core_probe_stream_t *self) {
self->drop(self);
}
#ifndef __SMCC_CORE_NO_MEM_PROBE_STREAM__