Skip to content

Commit 366250e

Browse files
committed
Use Vec::with_capacity to alloc buffer
1 parent 369afa5 commit 366250e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/symbolize/gimli/libs_windows.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ unsafe fn get_posix_path(long_path: &[u16]) -> Option<OsString> {
8080
return None;
8181
}
8282
let name_len = name_len as usize;
83-
let mut name_buffer = vec![0_u8; name_len];
83+
let mut name_buffer = Vec::with_capacity(name_len);
8484
// Safety: `name_buffer` is large enough.
8585
let res = unsafe {
8686
cygwin_conv_path(
8787
CCP_WIN_W_TO_POSIX,
8888
long_path.as_ptr(),
8989
name_buffer.as_mut_ptr(),
90-
name_buffer.len(),
90+
name_len,
9191
)
9292
};
9393
// It's not likely to return error here.

0 commit comments

Comments
 (0)