Skip to content

Make match_ignore_ascii_case more efficient, add ascii_case_insensitive_phf_map #122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Feb 25, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Support macros being used in a module with #[deny(unsafe_code)]
  • Loading branch information
SimonSapin committed Feb 25, 2017
commit df6892b17b17d94e50a9c96964c6da2e43f65b67
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,14 @@ macro_rules! _cssparser_internal__to_lowercase {
#[allow(dead_code)]
struct Dummy2;

// MAX_LENGTH is generated by cssparser__match_ignore_ascii_case__max_len
let mut buffer: [u8; MAX_LENGTH] =
// `buffer` is only used in `_internal__to_lowercase`,
// which initializes with `copy_from_slice` the part of the buffer it uses,
// before it uses it.
unsafe {
::std::mem::uninitialized()
};
// mem::uninitialized() is ok because `buffer` is only used in `_internal__to_lowercase`,
// which initializes with `copy_from_slice` the part of the buffer it uses,
// before it uses it.
#[allow(unsafe_code)]
// MAX_LENGTH is generated by cssparser__max_len
let mut buffer: [u8; MAX_LENGTH] = unsafe {
::std::mem::uninitialized()
};
let $output = $crate::_internal__to_lowercase(&mut buffer, $input);
}
}
Expand Down