Skip to content

Commit

Permalink
fix: removed records on payload (causes page faults)
Browse files Browse the repository at this point in the history
  • Loading branch information
keyboard-slayer committed Feb 21, 2023
1 parent 3e84707 commit 5b59759
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ typedef struct
size_t size;
char *string;
HandoverPayload *payload;
HandoverRecord *records;
} HandoverBuilder;

static inline void handover_builder_init(HandoverBuilder *builder, void *buf, size_t size)
Expand All @@ -23,21 +22,19 @@ static inline void handover_builder_init(HandoverBuilder *builder, void *buf, si
.size = size,
.string = ((char *)buf) + size,
.payload = payload,
.records = builder->payload->records,
};
}

static inline void handover_builder_append(HandoverBuilder *builder, HandoverRecord record)
{
builder->records[builder->payload->count++] = record;
builder->payload->records[builder->payload->count++] = record;
}

static inline size_t handover_builder_append_str(HandoverBuilder *builder, const char *str)
{
size_t len = strlen(str) + 1;
builder->string -= len;
memcpy(builder->string, str, len);
builder->string[len] = 0;
return builder->string - (char *)builder->buf;
}

Expand Down

0 comments on commit 5b59759

Please sign in to comment.