abg-reader: fix comment of function

Message ID 20220919100350.9661-1-hexiaole1994@126.com
State New
Headers
Series abg-reader: fix comment of function |

Commit Message

Xiaole He Sept. 19, 2022, 10:03 a.m. UTC
  In 'src/abg-reader.cc', the function
'walk_xml_node_to_map_type_ids(read_context& ctxt, xmlNodePtr node)'
find all of the child nodes of 'node' that has the 'id' attribute,
and then put the child node into map where the 'id' of the child node
as key and the child node itself as the value.
But the comment for this function writes:
/* src/abg-reader.cc begin */
/// Walk an entire XML sub-tree to build a map where the key is the
/// the value of the 'id' attribute (for type definitions) and the key
/// is the xml node containing the 'id' attribute.
...
static void
walk_xml_node_to_map_type_ids(read_context& ctxt,
                              xmlNodePtr node)
...
/* src/abg-reader.cc end */
The second and third lines of the comment above says the the child node
as the key of the map, but it should be the value of the map.
This patch fix the problematic comment described above, from
'and the key is the xml node' to 'and the value is the xml node'.

        * src/abg-reader.cc (walk_xml_node_to_map_type_ids): fix comment

Signed-off-by: Xiaole He <hexiaole@kylinos.cn>
---
 src/abg-reader.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Dodji Seketeli Sept. 20, 2022, 8:22 a.m. UTC | #1
Hello,

Xiaole He via Libabigail <libabigail@sourceware.org> a écrit:

> In 'src/abg-reader.cc', the function
> 'walk_xml_node_to_map_type_ids(read_context& ctxt, xmlNodePtr node)'
> find all of the child nodes of 'node' that has the 'id' attribute,
> and then put the child node into map where the 'id' of the child node
> as key and the child node itself as the value.
> But the comment for this function writes:
> /* src/abg-reader.cc begin */
> /// Walk an entire XML sub-tree to build a map where the key is the
> /// the value of the 'id' attribute (for type definitions) and the key
> /// is the xml node containing the 'id' attribute.
> ...
> static void
> walk_xml_node_to_map_type_ids(read_context& ctxt,
>                               xmlNodePtr node)
> ...
> /* src/abg-reader.cc end */
> The second and third lines of the comment above says the the child node
> as the key of the map, but it should be the value of the map.
> This patch fix the problematic comment described above, from
> 'and the key is the xml node' to 'and the value is the xml node'.
>
>         * src/abg-reader.cc (walk_xml_node_to_map_type_ids): fix comment

Thanks for catching that typo!  You are spot on!

I've applied the patch to the master branch.

[...]

Cheers,
  
Xiaole He Sept. 20, 2022, 9:10 a.m. UTC | #2
Copy that, thank you for reviewing.

















At 2022-09-20 16:22:46, "Dodji Seketeli" <dodji@seketeli.org> wrote:
>Hello,
>
>Xiaole He via Libabigail <libabigail@sourceware.org> a écrit:
>
>> In 'src/abg-reader.cc', the function
>> 'walk_xml_node_to_map_type_ids(read_context& ctxt, xmlNodePtr node)'
>> find all of the child nodes of 'node' that has the 'id' attribute,
>> and then put the child node into map where the 'id' of the child node
>> as key and the child node itself as the value.
>> But the comment for this function writes:
>> /* src/abg-reader.cc begin */
>> /// Walk an entire XML sub-tree to build a map where the key is the
>> /// the value of the 'id' attribute (for type definitions) and the key
>> /// is the xml node containing the 'id' attribute.
>> ...
>> static void
>> walk_xml_node_to_map_type_ids(read_context& ctxt,
>>                               xmlNodePtr node)
>> ...
>> /* src/abg-reader.cc end */
>> The second and third lines of the comment above says the the child node
>> as the key of the map, but it should be the value of the map.
>> This patch fix the problematic comment described above, from
>> 'and the key is the xml node' to 'and the value is the xml node'.
>>
>>         * src/abg-reader.cc (walk_xml_node_to_map_type_ids): fix comment
>
>Thanks for catching that typo!  You are spot on!
>
>I've applied the patch to the master branch.
>
>[...]
>
>Cheers,
>
>-- 
>		Dodji
  

Patch

diff --git a/src/abg-reader.cc b/src/abg-reader.cc
index be2b8c13..b6372e50 100644
--- a/src/abg-reader.cc
+++ b/src/abg-reader.cc
@@ -1538,7 +1538,7 @@  advance_cursor(read_context& ctxt)
 }
 
 /// Walk an entire XML sub-tree to build a map where the key is the
-/// the value of the 'id' attribute (for type definitions) and the key
+/// the value of the 'id' attribute (for type definitions) and the value
 /// is the xml node containing the 'id' attribute.
 ///
 /// @param ctxt the context of the reader.