From 83428cbf0a8d7e0bdd7a91c00124381c1db42e70 Mon Sep 17 00:00:00 2001
From: Campbell Barton <ideasman42@gmail.com>
Date: Mon, 28 Jan 2019 21:13:19 +1100
Subject: [PATCH] c_sort_blocks: Also sort 'typedef struct ... ...;'

---
 utils_maintenance/c_sort_blocks.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/utils_maintenance/c_sort_blocks.py b/utils_maintenance/c_sort_blocks.py
index 8d282e6..09e00a9 100755
--- a/utils_maintenance/c_sort_blocks.py
+++ b/utils_maintenance/c_sort_blocks.py
@@ -50,7 +50,10 @@ def sort_struct_lists(fn, data_src):
     re_match_struct = re.compile(r"struct\s+[A-Za-z_][A-Za-z_0-9]*\s*;")
     # eg:
     #    extern StructRNA RNA_LightProbe;
-    re_match_struct_type = re.compile(r"struct\s+[A-Za-z_][A-Za-z_0-9]*\s+[A-Za-z_][A-Za-z_0-9]*;")
+    re_match_struct_type = re.compile(r"struct\s+[A-Za-z_][A-Za-z_0-9]*\s+[A-Za-z_][A-Za-z_0-9]*\s*;")
+
+    #    typedef struct BMBVHTree BMBVHTree;
+    re_match_typedef_struct_type = re.compile(r"typedef\s+struct\s+[A-Za-z_][A-Za-z_0-9]*\s+[A-Za-z_][A-Za-z_0-9]*\s*;")
 
     re_match_enum = re.compile(r"enum\s+[A-Za-z_][A-Za-z_0-9]*\s*;")
 
@@ -65,11 +68,13 @@ def sort_struct_lists(fn, data_src):
             return 1
         if re_match_struct_type.match(l):
             return 2
-        if re_match_enum.match(l):
+        if re_match_typedef_struct_type.match(l):
             return 3
+        if re_match_enum.match(l):
+            return 4
         # Disable for now.
         # if re_match_datatoc.match(l):
-        #     return 4
+        #     return 5
         return None
 
     i = 0
-- 
GitLab