[indent snipped]

> + std::string temp_dir_path = base_path[i] + entry->d_name 
> +                 + "/"; 
> + DIR *temp_dir = nullptr; 
> + struct dirent *temp_dir_entry = nullptr; 
> + int len_temp_dir_entry = 0; 
> + int len_input = strlen("_input"); 
> + 
> + if ((temp_dir = opendir(temp_dir_path.c_str())) != NULL) { 
> +         while ((temp_dir_entry = readdir(temp_dir)) != NULL) { 
> +                 len_temp_dir_entry = strlen(temp_dir_entry->d_name); 
> +                 if ((len_temp_dir_entry >= len_input 
> +                                 && !strcmp( 
> +                                                 temp_dir_entry->d_name 
> +                                                                 + 
> len_temp_dir_entry 
> +                                                                 - 
> len_input, "_input")) 
> +                                 && (!strncmp(temp_dir_entry->d_name, 
> "temp", 
> +                                                 strlen("temp")))) { 

FTR, the suffix matching code here is...suboptimal, especially as
std::string is being used elsewhere in the same code block. I don't see
an error here, but the unnecessary complexity is a risk. I nearly
rejected this asking for it to be rewritten, and it took me a
disproportionately large amount of SRU review time to understand it as
well as the previous suboptimal sensor_mask/mask obtuseness.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2054391

Title:
  Fix  CPU thermal sensors enumeration

To manage notifications about this bug go to:
https://bugs.launchpad.net/hwe-next/+bug/2054391/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to