(code_part: &str)
| 2786 | } |
| 2787 | |
| 2788 | fn find_stdint_matches(code_part: &str) -> Vec<&'static str> { |
| 2789 | let bytes = code_part.as_bytes(); |
| 2790 | let mut matches = Vec::new(); |
| 2791 | |
| 2792 | for (type_name, _) in STDINT_TYPE_MAPPINGS { |
| 2793 | if *type_name == "unsigned int" || *type_name == "signed int" { |
| 2794 | continue; |
| 2795 | } |
| 2796 | let mut search_start = 0; |
| 2797 | while let Some(relative_pos) = code_part[search_start..].find(type_name) { |
| 2798 | let pos = search_start + relative_pos; |
| 2799 | let end = pos + type_name.len(); |
| 2800 | search_start = end; |
| 2801 | |
| 2802 | if (pos == 0 || !is_ascii_word_byte(bytes[pos - 1])) |
| 2803 | && (end >= bytes.len() || !is_ascii_word_byte(bytes[end])) |
| 2804 | { |
| 2805 | matches.push(*type_name); |
| 2806 | } |
| 2807 | } |
| 2808 | } |
| 2809 | |
| 2810 | for type_name in ["unsigned int", "signed int"] { |
| 2811 | let mut search_start = 0; |
| 2812 | while let Some(relative_pos) = code_part[search_start..].find(type_name) { |
| 2813 | let pos = search_start + relative_pos; |
| 2814 | let end = pos + type_name.len(); |
| 2815 | search_start = end; |
| 2816 | |
| 2817 | let Some(next) = bytes.get(end).copied() else { |
| 2818 | continue; |
| 2819 | }; |
| 2820 | if !matches!(next, b' ' | b'*' | b'&' | b',' | b')' | b']') { |
| 2821 | continue; |
| 2822 | } |
| 2823 | if (pos == 0 || !is_ascii_word_byte(bytes[pos - 1])) && !is_ascii_word_byte(next) { |
| 2824 | matches.push(type_name); |
| 2825 | } |
| 2826 | } |
| 2827 | } |
| 2828 | |
| 2829 | matches |
| 2830 | } |
| 2831 | |
| 2832 | fn stdint_fl_type(type_name: &str) -> &'static str { |
| 2833 | STDINT_TYPE_MAPPINGS |
no test coverage detected