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 committed Dec 18, 2019
1 parent b0298ae commit 5552358
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 5552358

Please sign in to comment.