LCOV - code coverage report
Current view: top level - /home/ubuntu/zephyrproject/zephyr/lib/utils - set.c (source / functions) Coverage Total Hit
Test: lcov.info Lines: 0.0 % 17 0
Test Date: 2026-11-06 14:43:19 Functions: 0.0 % 2 0
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0.0 % 8 0

             Branch data     Line data    Source code
       1                 :             : /*
       2                 :             :  * Copyright (c) 2025 James Roy <rruuaanng@outlook.com>
       3                 :             :  *
       4                 :             :  * SPDX-License-Identifier: Apache-2.0
       5                 :             :  */
       6                 :             : 
       7                 :             : #include <zephyr/sys/set.h>
       8                 :             : 
       9                 :           0 : struct sys_set_node *sys_set_find(struct sys_set_node *node)
      10                 :             : {
      11                 :           0 :         struct sys_set_node *parent;
      12                 :             : 
      13         [ #  # ]:           0 :         while (node != node->parent) {
      14                 :           0 :                 parent = node->parent;
      15                 :           0 :                 node->parent = parent->parent;
      16                 :           0 :                 node = parent;
      17                 :             :         }
      18                 :             : 
      19                 :           0 :         return node;
      20                 :             : }
      21                 :             : 
      22                 :           0 : void sys_set_union(struct sys_set_node *node1, struct sys_set_node *node2)
      23                 :             : {
      24                 :           0 :         struct sys_set_node *root1 = sys_set_find(node1);
      25                 :           0 :         struct sys_set_node *root2 = sys_set_find(node2);
      26                 :             : 
      27         [ #  # ]:           0 :         if (root1 == root2) {
      28                 :             :                 return;
      29                 :             :         }
      30                 :             : 
      31         [ #  # ]:           0 :         if (root1->rank < root2->rank) {
      32                 :           0 :                 root1->parent = root2;
      33         [ #  # ]:           0 :         } else if (root1->rank > root2->rank) {
      34                 :           0 :                 root2->parent = root1;
      35                 :             :         } else {
      36                 :           0 :                 root2->parent = root1;
      37                 :           0 :                 root1->rank++;
      38                 :             :         }
      39                 :             : }
        

Generated by: LCOV version 2.0-1