(config: &[u8], name: &str)
| 169 | |
| 170 | #[cfg(feature = "system")] |
| 171 | fn is_linux_kernel_config_item_enabled(config: &[u8], name: &str) -> io::Result<bool> { |
| 172 | for line in io::Cursor::new(config).lines() { |
| 173 | let line = line?; |
| 174 | let line = line.trim(); |
| 175 | if line.is_empty() || line.starts_with('#') { |
| 176 | continue; |
| 177 | } |
| 178 | |
| 179 | let mut iter = line.splitn(2, '='); |
| 180 | if let Some(current_name) = iter.next().map(str::trim) { |
| 181 | if current_name == name { |
| 182 | if let Some(mut value) = iter.next().map(str::trim) { |
| 183 | if value.starts_with('"') && value.ends_with('"') { |
| 184 | // Just remove the quotes, but don't bother unescaping the inner string |
| 185 | // because we are only trying to find out if the option is a true boolean. |
| 186 | value = &value[1..(value.len() - 2)]; |
| 187 | } |
| 188 | |
| 189 | return Ok(value == "y" || value == "m"); |
| 190 | } |
| 191 | } |
| 192 | } |
| 193 | } |
| 194 | Ok(false) |
| 195 | } |
| 196 | |
| 197 | #[cfg(feature = "system")] |
| 198 | fn linux_kernel_config_item_is_enabled(name: &str) -> io::Result<bool> { |
no test coverage detected