Skip to content

Commit

Permalink
Fix rebase conflicts
Browse files Browse the repository at this point in the history
Co-Authored-By: Dylan Thacker-Smith <[email protected]>
  • Loading branch information
peterzhu2118 and dylanahsmith committed Jan 8, 2021
1 parent bffc52c commit 387b84b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
10 changes: 5 additions & 5 deletions ext/liquid_c/document_body.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ static void document_body_write_tag_markup(document_body_t *body, VALUE tag_mark
uint32_t tag_name_len = (uint32_t)RSTRING_LEN(tag_markup->tag_name);
uint32_t markup_len = (uint32_t)RSTRING_LEN(tag_markup->markup);
uint32_t total_len = sizeof(tag_markup_header_t) + tag_name_len + markup_len;
assert(c_buffer_size(&body->buffer) % alignof(tag_markup_header_t) == 0);
tag_markup_header_t *header = c_buffer_extend_for_write(&body->buffer, total_len);
assert(c_buffer_size(&body->as.mutable.buffer) % alignof(tag_markup_header_t) == 0);
tag_markup_header_t *header = c_buffer_extend_for_write(&body->as.mutable.buffer, total_len);
if (!last) {
total_len += (uint32_t)c_buffer_zero_pad_for_alignment(&body->buffer, alignof(tag_markup_header_t));
total_len += (uint32_t)c_buffer_zero_pad_for_alignment(&body->as.mutable.buffer, alignof(tag_markup_header_t));
}
char *name = (char *)&header[1];

Expand Down Expand Up @@ -118,7 +118,7 @@ void document_body_write_block_body(VALUE self, bool blank, uint32_t render_scor

size_t instructions_byte_size = c_buffer_size(&code->instructions);
size_t header_and_instructions_size = sizeof(block_body_header_t) + instructions_byte_size;
block_body_header_t *buf_block_body = c_buffer_extend_for_write(&body->buffer, header_and_instructions_size);
block_body_header_t *buf_block_body = c_buffer_extend_for_write(&body->as.mutable.buffer, header_and_instructions_size);
uint8_t *instructions = (uint8_t *)&buf_block_body[1];

buf_block_body->flags = 0;
Expand All @@ -140,7 +140,7 @@ void document_body_write_block_body(VALUE self, bool blank, uint32_t render_scor
uint32_t tags_len = (uint32_t)(c_buffer_size(&code->tag_markups) / sizeof(VALUE));
if (tags_len > 0) {
buf_block_body->first_tag_offset = (uint32_t)header_and_instructions_size;
buf_block_body->first_tag_offset += (uint32_t)c_buffer_zero_pad_for_alignment(&body->buffer, alignof(tag_markup_header_t));
buf_block_body->first_tag_offset += (uint32_t)c_buffer_zero_pad_for_alignment(&body->as.mutable.buffer, alignof(tag_markup_header_t));

uint32_t i;
for (i = 0; i < tags_len - 1; i++) {
Expand Down
7 changes: 2 additions & 5 deletions ext/liquid_c/serialize_parse_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ VALUE serialize_parse_context_new(VALUE document_body, document_body_header_t *h

obj = TypedData_Make_Struct(cLiquidCSerializeParseContext, serialize_parse_context_t,
&serialize_parse_context_data_type, serialize_context);
assert(header->entrypoint_block_index < header->buffer_len);
assert(header->entrypoint_block_offset < header->buffer_len);
serialize_context->document_body = document_body;
document_body_setup_entry_for_header(document_body, header->entrypoint_block_index,
document_body_setup_entry_for_header(document_body, header->entrypoint_block_offset,
&serialize_context->current_entry);
serialize_context->current_tag = tag_markup_get_next_tag(&serialize_context->current_entry, NULL);

// Call initialize method of parent class
rb_funcall(obj, id_initialize, 0);
Expand All @@ -55,15 +54,13 @@ bool is_serialize_parse_context_p(VALUE self)
void serialize_parse_context_enter_tag(serialize_parse_context_t *serialize_context, tag_markup_header_t *tag)
{
serialize_context->current_entry.buffer_offset = tag->block_body_offset;
serialize_context->current_tag = tag_markup_get_next_tag(&serialize_context->current_entry, NULL);
}

void serialize_parse_context_exit_tag(serialize_parse_context_t *serialize_context, document_body_entry_t *entry,
tag_markup_header_t *tag)
{
assert(serialize_context->current_entry.body == entry->body);
serialize_context->current_entry = *entry;
serialize_context->current_tag = tag_markup_get_next_tag(&serialize_context->current_entry, tag);
}

void liquid_define_serialize_parse_context()
Expand Down

0 comments on commit 387b84b

Please sign in to comment.