[devhelp] parser: more logical order in parser_start_node_cb()



commit d1de516068b2076b437b783d87af3c92a8fc5ad4
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri May 12 09:25:56 2017 +0200

    parser: more logical order in parser_start_node_cb()
    
    The same order as in the index files (generated with gtk-doc). Also the
    same order as the function implementations.
    
    In general there are more keywords than chapters, so the reverse order
    was maybe to scrounge a tiny bit of performance. But here it's just
    reading one more boolean value in a condition, that's nothing compared
    to I/O.

 src/dh-parser.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/dh-parser.c b/src/dh-parser.c
index 6df8470..db9bd94 100644
--- a/src/dh-parser.c
+++ b/src/dh-parser.c
@@ -426,26 +426,26 @@ parser_start_node_cb (GMarkupParseContext  *context,
                 return;
         }
 
-        if (parser->parsing_keywords) {
-                parser_start_node_keyword (parser,
+        if (parser->parsing_chapters) {
+                parser_start_node_chapter (parser,
                                            context,
                                            node_name,
                                            attribute_names,
                                            attribute_values,
                                            error);
                 return;
-        } else if (parser->parsing_chapters) {
-                parser_start_node_chapter (parser,
+        } else if (parser->parsing_keywords) {
+                parser_start_node_keyword (parser,
                                            context,
                                            node_name,
                                            attribute_names,
                                            attribute_values,
                                            error);
                 return;
-        } else if (g_ascii_strcasecmp (node_name, "functions") == 0) {
-                parser->parsing_keywords = TRUE;
         } else if (g_ascii_strcasecmp (node_name, "chapters") == 0) {
                 parser->parsing_chapters = TRUE;
+        } else if (g_ascii_strcasecmp (node_name, "functions") == 0) {
+                parser->parsing_keywords = TRUE;
         }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]