Skip to content

Commit

Permalink
Replace the scratch buffer with a temporary buffer.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode authored and Jakub Konka committed Jan 2, 2020
1 parent ae2a60f commit cc3cf24
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions crates/wasi-common/src/sandboxed_tty_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ where
Writer: Write,
{
inner: &'writer mut Writer,

/// Temporary buffer for holding UTF-8 encodings of `char`s, which
/// are at most 4 bytes long.
scratch: [u8; 4],
}

impl<'writer, Writer> SandboxedTTYWriter<'writer, Writer>
Expand All @@ -23,7 +19,6 @@ where
pub(crate) fn new(inner: &'writer mut Writer) -> Self {
Self {
inner,
scratch: [0; 4],
}
}

Expand Down Expand Up @@ -67,7 +62,7 @@ where
x if x.is_control() => '�',
x => x,
}
.encode_utf8(&mut [0; 4])
.encode_utf8(&mut [0; 4]) // UTF-8 encoding of a `char` is at most 4 bytes.
.as_bytes(),
)?;

Expand Down

0 comments on commit cc3cf24

Please sign in to comment.