Change std.mem.copy to @memcpy (#18)
This commit is contained in:
parent
86f5435f63
commit
77ccba4b4a
|
@ -772,8 +772,9 @@ fn diffCleanupMerge(allocator: std.mem.Allocator, diffs: *DiffList) DiffError!vo
|
|||
var nt = try allocator.alloc(u8, diffs.items[ii].text.len + common_length);
|
||||
|
||||
// try diffs.items[pointer - count_delete - count_insert - 1].text.append(allocator, text_insert.items[0..common_length]);
|
||||
std.mem.copy(u8, nt, diffs.items[ii].text);
|
||||
std.mem.copy(u8, nt[diffs.items[ii].text.len..], text_insert.items[0..common_length]);
|
||||
const ot = diffs.items[ii].text;
|
||||
@memcpy(nt[0..ot.len], ot);
|
||||
@memcpy(nt[ot.len..], text_insert.items[0..common_length]);
|
||||
|
||||
// allocator.free(diffs.items[ii].text);
|
||||
diffs.items[ii].text = nt;
|
||||
|
@ -825,8 +826,9 @@ fn diffCleanupMerge(allocator: std.mem.Allocator, diffs: *DiffList) DiffError!vo
|
|||
var nt = try allocator.alloc(u8, diffs.items[pointer - 1].text.len + diffs.items[pointer].text.len);
|
||||
|
||||
// try diffs.items[pointer - count_delete - count_insert - 1].text.append(allocator, text_insert.items[0..common_length]);
|
||||
std.mem.copy(u8, nt, diffs.items[pointer - 1].text);
|
||||
std.mem.copy(u8, nt[diffs.items[pointer - 1].text.len..], diffs.items[pointer].text);
|
||||
const ot = diffs.items[pointer - 1].text;
|
||||
@memcpy(nt[0..ot.len], ot);
|
||||
@memcpy(nt[ot.len..], diffs.items[pointer].text);
|
||||
|
||||
// allocator.free(diffs.items[pointer - 1].text);
|
||||
diffs.items[pointer - 1].text = nt;
|
||||
|
|
Loading…
Reference in New Issue
Block a user