Skip to contentSkip to conversation

maple_tree: fix comment typo of ma_root

PATCH Applied Wei Yang 2 participants 4 messages Aug 12, 2024 – Aug 14, 2024

Subsystems (2)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/2 maple_tree: fix comment typo of ma_root

In comment of mas_start(), we lists the return value for different cases. In case of a single entry, we set mas->status to ma_root, while the comment uses mas_root, which is not a maple_status.

Fix the typo according to the code.

---
 lib/maple_tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/maple_tree.c +1 -1
index 3d2e207d9a5f..14ff54078f9e 100644
@@ -1346,7 +1346,7 @@ static void mas_node_count(struct ma_state *mas, int count)
  * Return:
  * - If mas->node is an error or not mas_start, return NULL.
  * - If it's an empty tree:     NULL & mas->status == ma_none
- * - If it's a single entry:    The entry & mas->status == mas_root
+ * - If it's a single entry:    The entry & mas->status == ma_root
  * - If it's a tree:            NULL & mas->status == safe root node.
  */
 static inline struct maple_enode *mas_start(struct ma_state *mas)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 2/2 maple_tree: fix comment typo with corresponding maple_status

In comment of function mas_start(), we list the return value of different cases. According to the comment context, tell the maple_status here is more consistent with others.

Let's correct it with ma_active in the case it's a tree.

---
 lib/maple_tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/maple_tree.c +1 -1
index 14ff54078f9e..026197c44988 100644
@@ -1347,7 +1347,7 @@ static void mas_node_count(struct ma_state *mas, int count)
  * - If mas->node is an error or not mas_start, return NULL.
  * - If it's an empty tree:     NULL & mas->status == ma_none
  * - If it's a single entry:    The entry & mas->status == ma_root
- * - If it's a tree:            NULL & mas->status == safe root node.
+ * - If it's a tree:            NULL & mas->status == ma_active
  */
 static inline struct maple_enode *mas_start(struct ma_state *mas)
 {
Signature · 1 line
2.34.1
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] maple_tree: fix comment typo with corresponding maple_status

Quoted 16 lines · Wei Yang

In comment of function mas_start(), we list the return value of different cases. According to the comment context, tell the maple_status here is more consistent with others.

Let's correct it with ma_active in the case it's a tree.

---
 lib/maple_tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/maple_tree.c +0 -0
index 14ff54078f9e..026197c44988 100644

lib/maple_tree.c static void mas_node_count(struct ma_state *mas, int count) · line 1350

Quoted 5 lines
lib/maple_tree.c +1 -1
@@ -1347,7 +1347,7 @@ static void mas_node_count(struct ma_state *mas, int count)
  * - If mas->node is an error or not mas_start, return NULL.
  * - If it's an empty tree:     NULL & mas->status == ma_none
  * - If it's a single entry:    The entry & mas->status == ma_root
- * - If it's a tree:            NULL & mas->status == safe root node.
+ * - If it's a tree:            NULL & mas->status == ma_active

This was obvious fallout from the removal of the mas->node overloading and adding a status for underflow/overflow. With this change, the detail that mas->node == safe root node is lost in favour of the status being set to active. Both are important. Maybe this comment needs further clearing up to state what mas->node is, but we are basically documenting what happens in the function so I don't think it's worth fixing.

Quoted 6 lines
lib/maple_tree.c +0 -0
  */
 static inline struct maple_enode *mas_start(struct ma_state *mas)
 {
Signature · 1 line
2.34.1
Reviewed-by on v1 1/2
#3 lore raw
In reply to Wei Yang
Quoted 7 lines · Wei Yang

In comment of mas_start(), we lists the return value for different cases. In case of a single entry, we set mas->status to ma_root, while the comment uses mas_root, which is not a maple_status.

Fix the typo according to the code.

If you are fixing typos in a single comment, we can probably do that in one patch.

Quoted 20 lines
---
 lib/maple_tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/maple_tree.c +1 -1
index 3d2e207d9a5f..14ff54078f9e 100644
@@ -1346,7 +1346,7 @@ static void mas_node_count(struct ma_state *mas, int count)
  * Return:
  * - If mas->node is an error or not mas_start, return NULL.
  * - If it's an empty tree:     NULL & mas->status == ma_none
- * - If it's a single entry:    The entry & mas->status == mas_root
+ * - If it's a single entry:    The entry & mas->status == ma_root
  * - If it's a tree:            NULL & mas->status == safe root node.
  */
 static inline struct maple_enode *mas_start(struct ma_state *mas)
Signature · 1 line
2.34.1