Skip to content

Commit

Permalink
avoid string reallocation
Browse files Browse the repository at this point in the history
  • Loading branch information
jrouaix committed Nov 29, 2024
1 parent 03b31e1 commit ba57606
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/decoders/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,13 @@ fn parse_svcb_ip(mut input: &[u8]) -> nom::IResult<&[u8], String> {
if ip_version == IPV4 {
let mut iter = iterator(ip_data, ipv4_parser);
for ip in iter.into_iter() {
ipv4_hint = format!("{}{},", ipv4_hint, ip);
write!(ipv4_hint, "{},", ip).ok(); // ignore errors on write in String
}
iter.finish()?;
} else if ip_version == IPV6 {
let mut iter = iterator(ip_data, ipv6_parser);
for ip in iter.into_iter() {
ipv6_hint = format!("{}{},", ipv6_hint, ip);
write!(ipv6_hint, "{},", ip).ok(); // ignore errors on write in String
}
iter.finish()?;
}
Expand Down

0 comments on commit ba57606

Please sign in to comment.