fx: stringstream: rename ptr() to get_cstr()

This commit is contained in:
2026-06-20 15:22:09 +01:00
parent f6320d64cd
commit 7cbd1eb162
4 changed files with 9 additions and 6 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ FX_API fx_status fx_stringstream_reset(fx_stringstream *strv);
FX_API fx_status FX_API fx_status
fx_stringstream_reset_with_buffer(fx_stringstream *strv, char *buf, size_t max); fx_stringstream_reset_with_buffer(fx_stringstream *strv, char *buf, size_t max);
FX_API const char *fx_stringstream_ptr(const fx_stringstream *strv); FX_API const char *fx_stringstream_get_cstr(const fx_stringstream *strv);
FX_API char *fx_stringstream_steal(fx_stringstream *strv); FX_API char *fx_stringstream_steal(fx_stringstream *strv);
FX_API size_t fx_stringstream_get_length(const fx_stringstream *strv); FX_API size_t fx_stringstream_get_length(const fx_stringstream *strv);
+1 -1
View File
@@ -478,7 +478,7 @@ static fx_status string_replace_all_with_stringstream(
size_t new_len = fx_stringstream_get_length(new_data); size_t new_len = fx_stringstream_get_length(new_data);
string_reserve(str, new_len); string_reserve(str, new_len);
char *dest = string_ptr(str); char *dest = string_ptr(str);
memcpy(dest, fx_stringstream_ptr(new_data), new_len); memcpy(dest, fx_stringstream_get_cstr(new_data), new_len);
dest[new_len] = '\0'; dest[new_len] = '\0';
str->s_len = new_len; str->s_len = new_len;
+6 -3
View File
@@ -141,7 +141,7 @@ static size_t stringstream_get_length(const struct fx_stringstream_p *strv)
return strv->ss_len; return strv->ss_len;
} }
static const char *stringstream_ptr(const struct fx_stringstream_p *ss) static const char *stringstream_get_cstr(const struct fx_stringstream_p *ss)
{ {
return ss->ss_buf; return ss->ss_buf;
} }
@@ -236,9 +236,12 @@ enum fx_status fx_stringstream_reset_with_buffer(
max); max);
} }
const char *fx_stringstream_ptr(const fx_stringstream *ss) const char *fx_stringstream_get_cstr(const fx_stringstream *ss)
{ {
FX_CLASS_DISPATCH_STATIC_0(FX_TYPE_STRINGSTREAM, stringstream_ptr, ss); FX_CLASS_DISPATCH_STATIC_0(
FX_TYPE_STRINGSTREAM,
stringstream_get_cstr,
ss);
} }
char *fx_stringstream_steal(fx_stringstream *ss) char *fx_stringstream_steal(fx_stringstream *ss)
+1 -1
View File
@@ -181,7 +181,7 @@ static fx_status value_change_string(fx_value *in, fx_value *out)
} }
fx_string *result fx_string *result
= fx_string_create_from_cstr(fx_stringstream_ptr(strm)); = fx_string_create_from_cstr(fx_stringstream_get_cstr(strm));
fx_stringstream_unref(strm); fx_stringstream_unref(strm);
if (!result) { if (!result) {