mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-04 19:10:47 -05:00
Do not always zero initialize for rust resize vec
This commit is contained in:
@@ -209,15 +209,17 @@ off_t rust_vec_channel::seek(off_t off, int whence) {
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
ensure_size(np);
|
||||
ensure_size(np, true);
|
||||
_pos = np;
|
||||
return np;
|
||||
}
|
||||
|
||||
void rust_vec_channel::ensure_size(size_t sz) {
|
||||
void rust_vec_channel::ensure_size(size_t sz, bool zero) {
|
||||
size_t old_sz = _data.size();
|
||||
if (sz > old_sz) {
|
||||
resize_vec(_data, sz);
|
||||
if (zero)
|
||||
memset(_data.data() + old_sz, 0, sz - old_sz);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user