Skip to content

Commit a96f446

Browse files
Undo changes to bytes2string
1 parent 97cde58 commit a96f446

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

runtime/strings/bytes.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,17 @@ hook_BYTES_int2bytes(SortInt len, SortInt i, SortEndianness endianness_ptr) {
148148
return result;
149149
}
150150

151-
SortString hook_BYTES_bytes2string(SortBytes b) {
152-
auto len_b = len(b);
153-
auto *result
154-
= static_cast<string *>(kore_alloc_token(sizeof(string) + len_b));
155-
memcpy(result->data, b->data, len_b);
156-
init_with_len(result, len_b);
151+
string *bytes2string(string *b, size_t len) {
152+
auto *result = static_cast<string *>(kore_alloc_token(sizeof(string) + len));
153+
memcpy(result->data, b->data, len);
154+
init_with_len(result, len);
157155
return result;
158156
}
159157

158+
SortString hook_BYTES_bytes2string(SortBytes b) {
159+
return bytes2string(b, len(b));
160+
}
161+
160162
SortBytes hook_BYTES_string2bytes(SortString s) {
161163
return hook_BYTES_bytes2string(s);
162164
}

0 commit comments

Comments
 (0)