pkstrings: rename strtohex to chrtohex

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2021-11-15 13:51:25 +01:00
parent 31290b2bbc
commit 1a9c5e0060
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -36,7 +36,7 @@ const fn in_range(ord: u8) -> bool {
}
}
const fn strtohex(chr: &char) -> Option<u8> {
const fn chrtohex(chr: &char) -> Option<u8> {
Some(match chr {
cap @ 'A'..='Z' => 0x80 - ('A' as u8) + (*cap as u8),
'(' => 0x9a,
@ -182,7 +182,7 @@ impl TryFrom<&str> for PKString {
let mut buf = Vec::with_capacity(data.len());
for chr in data.chars() {
match strtohex(&chr) {
match chrtohex(&chr) {
Some(ord) => buf.push(ord),
None => return Err(Error::InvalidCharacter(chr)),
}