c-string compact toggle param
This commit is contained in:
@@ -677,7 +677,7 @@ fn Codepoint codepointFromBytesBefore(ptr bytes, u32 offset);
|
|||||||
fn Codepoint codepointFromRawInt(u32 c);
|
fn Codepoint codepointFromRawInt(u32 c);
|
||||||
fn void codepointFillBuf(Codepoint cp, ptr buf);
|
fn void codepointFillBuf(Codepoint cp, ptr buf);
|
||||||
fn String stringFromRawCodepoint(Arena* a, u32 c);
|
fn String stringFromRawCodepoint(Arena* a, u32 c);
|
||||||
fn bool stringInsertCodepointAtByte(String* s, Codepoint c, u32 byte_offset);
|
fn bool stringInsertCodepointAtByte(String* s, Codepoint c, u32 byte_offset, bool keep_trailing_zero);
|
||||||
fn u8 stringDeleteCodepointAtByte(String* s, u32 byte_offset);
|
fn u8 stringDeleteCodepointAtByte(String* s, u32 byte_offset);
|
||||||
fn bool stringDeleteCodepointsBetweenByteOffsetsInclusive(String* s, u32 start, u32 end);
|
fn bool stringDeleteCodepointsBetweenByteOffsetsInclusive(String* s, u32 start, u32 end);
|
||||||
|
|
||||||
|
|||||||
@@ -244,8 +244,8 @@ fn String stringFromRawCodepoint(Arena* a, u32 c) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bool stringInsertCodepointAtByte(String* s, Codepoint c, u32 byte_offset) {
|
fn bool stringInsertCodepointAtByte(String* s, Codepoint c, u32 byte_offset, bool keep_trailing_zero) {
|
||||||
u32 remaining_space = s->capacity - s->length;
|
i32 remaining_space = (s->capacity - (keep_trailing_zero ? 1 : 0)) - s->length;
|
||||||
if (remaining_space < c.size) return false;
|
if (remaining_space < c.size) return false;
|
||||||
|
|
||||||
char codepoint_bytes[4];
|
char codepoint_bytes[4];
|
||||||
|
|||||||
Reference in New Issue
Block a user