[virt-tools-list] [libvirt] [PATCH 13/22] apibuild: Avoid double sorting of ids

Radostin Stoyanov rstoyanov1 at gmail.com
Sat Mar 17 13:48:49 UTC 2018


The uniq() function returns a sorted list, there is no need
to sort this list again.

Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
---
 docs/apibuild.py | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/docs/apibuild.py b/docs/apibuild.py
index 149cd41cc..400be124f 100755
--- a/docs/apibuild.py
+++ b/docs/apibuild.py
@@ -2319,8 +2319,7 @@ class docBuilder:
                 if desc.find("DEPRECATED") != -1:
                     output.write("     <deprecated/>\n")
 
-        ids = sorted(dict.macros.keys())
-        for id in uniq(ids):
+        for id in uniq(dict.macros.keys()):
             # Macros are sometime used to masquerade other types.
             if id in dict.functions:
                 continue
@@ -2335,20 +2334,15 @@ class docBuilder:
             if id in dict.enums:
                 continue
             output.write("     <exports symbol='%s' type='macro'/>\n" % (id))
-        ids = sorted(dict.enums.keys())
-        for id in uniq(ids):
+        for id in uniq(dict.enums.keys()):
             output.write("     <exports symbol='%s' type='enum'/>\n" % (id))
-        ids = sorted(dict.typedefs.keys())
-        for id in uniq(ids):
+        for id in uniq(dict.typedefs.keys()):
             output.write("     <exports symbol='%s' type='typedef'/>\n" % (id))
-        ids = sorted(dict.structs.keys())
-        for id in uniq(ids):
+        for id in uniq(dict.structs.keys()):
             output.write("     <exports symbol='%s' type='struct'/>\n" % (id))
-        ids = sorted(dict.variables.keys())
-        for id in uniq(ids):
+        for id in uniq(dict.variables.keys()):
             output.write("     <exports symbol='%s' type='variable'/>\n" % (id))
-        ids = sorted(dict.functions.keys())
-        for id in uniq(ids):
+        for id in uniq(dict.functions.keys()):
             output.write("     <exports symbol='%s' type='function'/>\n" % (id))
         output.write("    </file>\n")
 
@@ -2364,7 +2358,6 @@ class docBuilder:
                        list(dict.typedefs.keys()) + \
                        list(dict.structs.keys()) + \
                        list(dict.enums.keys()))
-            ids.sort()
             for id in ids:
                 output.write("      <ref name='%s'/>\n" % (id))
             output.write("    </file>\n")
-- 
2.14.3




More information about the virt-tools-list mailing list