mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Rename append_char_buffer
This commit is contained in:
@@ -307,21 +307,21 @@ fn bool DString.less(self, DString other_string)
|
|||||||
|
|
||||||
fn void DString.append_chars(&self, String str) @deprecated("Use append_string")
|
fn void DString.append_chars(&self, String str) @deprecated("Use append_string")
|
||||||
{
|
{
|
||||||
self.append_char_buffer(str);
|
self.append_bytes(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn void DString.append_char_buffer(&self, char[] str)
|
fn void DString.append_bytes(&self, char[] bytes)
|
||||||
{
|
{
|
||||||
usz other_len = str.len;
|
usz other_len = bytes.len;
|
||||||
if (!other_len) return;
|
if (!other_len) return;
|
||||||
if (!*self)
|
if (!*self)
|
||||||
{
|
{
|
||||||
*self = temp((String)str);
|
*self = temp((String)bytes);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.reserve(other_len);
|
self.reserve(other_len);
|
||||||
StringData* data = self.data();
|
StringData* data = self.data();
|
||||||
mem::copy(&data.chars[data.len], str.ptr, other_len);
|
mem::copy(&data.chars[data.len], bytes.ptr, other_len);
|
||||||
data.len += other_len;
|
data.len += other_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,7 +336,7 @@ fn Char32[] DString.copy_utf32(&self, Allocator allocator)
|
|||||||
macro void DString.append_string(&self, str)
|
macro void DString.append_string(&self, str)
|
||||||
{
|
{
|
||||||
$if $typeof(str) == String:
|
$if $typeof(str) == String:
|
||||||
self.append_char_buffer(str);
|
self.append_bytes(str);
|
||||||
$else
|
$else
|
||||||
self.append_string_deprecated(str);
|
self.append_string_deprecated(str);
|
||||||
$endif
|
$endif
|
||||||
@@ -362,7 +362,7 @@ fn void DString.clear(self)
|
|||||||
|
|
||||||
fn usz? DString.write(&self, char[] buffer) @dynamic
|
fn usz? DString.write(&self, char[] buffer) @dynamic
|
||||||
{
|
{
|
||||||
self.append_char_buffer(buffer);
|
self.append_bytes(buffer);
|
||||||
return buffer.len;
|
return buffer.len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
- Add `any.to` and `any.as`.
|
- Add `any.to` and `any.as`.
|
||||||
- Deprecated `DString.append_chars`, use `DString.append_string`
|
- Deprecated `DString.append_chars`, use `DString.append_string`
|
||||||
- Deprecated `DString.append_string` for DStrings, use `DString.append_dstring` instead.
|
- Deprecated `DString.append_string` for DStrings, use `DString.append_dstring` instead.
|
||||||
- Added `DString.append_char_buffer`.
|
- Added `DString.append_bytes`.
|
||||||
|
|
||||||
## 0.7.8 Change list
|
## 0.7.8 Change list
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user