[PATCH 2/4] parser: static cleanup

Adam Jackson ajax at redhat.com
Tue Jun 2 08:37:20 PDT 2015


Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 hw/xfree86/parser/InputClass.c  | 152 ++++++++++++++++++++--------------------
 hw/xfree86/parser/OutputClass.c |  52 +++++++-------
 hw/xfree86/parser/Screen.c      |  80 ++++++++++-----------
 hw/xfree86/parser/Vendor.c      |  32 ++++-----
 hw/xfree86/parser/configProcs.h |   6 --
 5 files changed, 158 insertions(+), 164 deletions(-)

diff --git a/hw/xfree86/parser/InputClass.c b/hw/xfree86/parser/InputClass.c
index c2fbd22..29bd9fa 100644
--- a/hw/xfree86/parser/InputClass.c
+++ b/hw/xfree86/parser/InputClass.c
@@ -58,6 +58,82 @@ xf86ConfigSymTabRec InputClassTab[] = {
     {-1, ""},
 };
 
+static void
+xf86freeInputClassList(XF86ConfInputClassPtr ptr)
+{
+    XF86ConfInputClassPtr prev;
+
+    while (ptr) {
+        xf86MatchGroup *group, *next;
+        char **list;
+
+        TestFree(ptr->identifier);
+        TestFree(ptr->driver);
+
+        xorg_list_for_each_entry_safe(group, next, &ptr->match_product, entry) {
+            xorg_list_del(&group->entry);
+            for (list = group->values; *list; list++)
+                free(*list);
+            free(group);
+        }
+        xorg_list_for_each_entry_safe(group, next, &ptr->match_vendor, entry) {
+            xorg_list_del(&group->entry);
+            for (list = group->values; *list; list++)
+                free(*list);
+            free(group);
+        }
+        xorg_list_for_each_entry_safe(group, next, &ptr->match_device, entry) {
+            xorg_list_del(&group->entry);
+            for (list = group->values; *list; list++)
+                free(*list);
+            free(group);
+        }
+        xorg_list_for_each_entry_safe(group, next, &ptr->match_os, entry) {
+            xorg_list_del(&group->entry);
+            for (list = group->values; *list; list++)
+                free(*list);
+            free(group);
+        }
+        xorg_list_for_each_entry_safe(group, next, &ptr->match_pnpid, entry) {
+            xorg_list_del(&group->entry);
+            for (list = group->values; *list; list++)
+                free(*list);
+            free(group);
+        }
+        xorg_list_for_each_entry_safe(group, next, &ptr->match_usbid, entry) {
+            xorg_list_del(&group->entry);
+            for (list = group->values; *list; list++)
+                free(*list);
+            free(group);
+        }
+        xorg_list_for_each_entry_safe(group, next, &ptr->match_driver, entry) {
+            xorg_list_del(&group->entry);
+            for (list = group->values; *list; list++)
+                free(*list);
+            free(group);
+        }
+        xorg_list_for_each_entry_safe(group, next, &ptr->match_tag, entry) {
+            xorg_list_del(&group->entry);
+            for (list = group->values; *list; list++)
+                free(*list);
+            free(group);
+        }
+        xorg_list_for_each_entry_safe(group, next, &ptr->match_layout, entry) {
+            xorg_list_del(&group->entry);
+            for (list = group->values; *list; list++)
+                free(*list);
+            free(group);
+        }
+
+        TestFree(ptr->comment);
+        xf86optionListFree(ptr->option_lst);
+
+        prev = ptr;
+        ptr = ptr->list.next;
+        free(prev);
+    }
+}
+
 #define CLEANUP xf86freeInputClassList
 
 #define TOKEN_SEP "|"
@@ -354,79 +430,3 @@ xf86printInputClassSection(FILE * cf, XF86ConfInputClassPtr ptr)
         ptr = ptr->list.next;
     }
 }
-
-void
-xf86freeInputClassList(XF86ConfInputClassPtr ptr)
-{
-    XF86ConfInputClassPtr prev;
-
-    while (ptr) {
-        xf86MatchGroup *group, *next;
-        char **list;
-
-        TestFree(ptr->identifier);
-        TestFree(ptr->driver);
-
-        xorg_list_for_each_entry_safe(group, next, &ptr->match_product, entry) {
-            xorg_list_del(&group->entry);
-            for (list = group->values; *list; list++)
-                free(*list);
-            free(group);
-        }
-        xorg_list_for_each_entry_safe(group, next, &ptr->match_vendor, entry) {
-            xorg_list_del(&group->entry);
-            for (list = group->values; *list; list++)
-                free(*list);
-            free(group);
-        }
-        xorg_list_for_each_entry_safe(group, next, &ptr->match_device, entry) {
-            xorg_list_del(&group->entry);
-            for (list = group->values; *list; list++)
-                free(*list);
-            free(group);
-        }
-        xorg_list_for_each_entry_safe(group, next, &ptr->match_os, entry) {
-            xorg_list_del(&group->entry);
-            for (list = group->values; *list; list++)
-                free(*list);
-            free(group);
-        }
-        xorg_list_for_each_entry_safe(group, next, &ptr->match_pnpid, entry) {
-            xorg_list_del(&group->entry);
-            for (list = group->values; *list; list++)
-                free(*list);
-            free(group);
-        }
-        xorg_list_for_each_entry_safe(group, next, &ptr->match_usbid, entry) {
-            xorg_list_del(&group->entry);
-            for (list = group->values; *list; list++)
-                free(*list);
-            free(group);
-        }
-        xorg_list_for_each_entry_safe(group, next, &ptr->match_driver, entry) {
-            xorg_list_del(&group->entry);
-            for (list = group->values; *list; list++)
-                free(*list);
-            free(group);
-        }
-        xorg_list_for_each_entry_safe(group, next, &ptr->match_tag, entry) {
-            xorg_list_del(&group->entry);
-            for (list = group->values; *list; list++)
-                free(*list);
-            free(group);
-        }
-        xorg_list_for_each_entry_safe(group, next, &ptr->match_layout, entry) {
-            xorg_list_del(&group->entry);
-            for (list = group->values; *list; list++)
-                free(*list);
-            free(group);
-        }
-
-        TestFree(ptr->comment);
-        xf86optionListFree(ptr->option_lst);
-
-        prev = ptr;
-        ptr = ptr->list.next;
-        free(prev);
-    }
-}
diff --git a/hw/xfree86/parser/OutputClass.c b/hw/xfree86/parser/OutputClass.c
index 7e9a8ac..3f2082e 100644
--- a/hw/xfree86/parser/OutputClass.c
+++ b/hw/xfree86/parser/OutputClass.c
@@ -41,6 +41,32 @@ xf86ConfigSymTabRec OutputClassTab[] = {
     {-1, ""},
 };
 
+static void
+xf86freeOutputClassList(XF86ConfOutputClassPtr ptr)
+{
+    XF86ConfOutputClassPtr prev;
+
+    while (ptr) {
+        xf86MatchGroup *group, *next;
+        char **list;
+
+        TestFree(ptr->identifier);
+        TestFree(ptr->comment);
+        TestFree(ptr->driver);
+
+        xorg_list_for_each_entry_safe(group, next, &ptr->match_driver, entry) {
+            xorg_list_del(&group->entry);
+            for (list = group->values; *list; list++)
+                free(*list);
+            free(group);
+        }
+
+        prev = ptr;
+        ptr = ptr->list.next;
+        free(prev);
+    }
+}
+
 #define CLEANUP xf86freeOutputClassList
 
 #define TOKEN_SEP "|"
@@ -139,29 +165,3 @@ xf86printOutputClassSection(FILE * cf, XF86ConfOutputClassPtr ptr)
         ptr = ptr->list.next;
     }
 }
-
-void
-xf86freeOutputClassList(XF86ConfOutputClassPtr ptr)
-{
-    XF86ConfOutputClassPtr prev;
-
-    while (ptr) {
-        xf86MatchGroup *group, *next;
-        char **list;
-
-        TestFree(ptr->identifier);
-        TestFree(ptr->comment);
-        TestFree(ptr->driver);
-
-        xorg_list_for_each_entry_safe(group, next, &ptr->match_driver, entry) {
-            xorg_list_del(&group->entry);
-            for (list = group->values; *list; list++)
-                free(*list);
-            free(group);
-        }
-
-        prev = ptr;
-        ptr = ptr->list.next;
-        free(prev);
-    }
-}
diff --git a/hw/xfree86/parser/Screen.c b/hw/xfree86/parser/Screen.c
index b5b454f..4731970 100644
--- a/hw/xfree86/parser/Screen.c
+++ b/hw/xfree86/parser/Screen.c
@@ -76,6 +76,33 @@ static xf86ConfigSymTabRec DisplayTab[] = {
     {-1, ""},
 };
 
+static void
+xf86freeModeList(XF86ModePtr ptr)
+{
+    XF86ModePtr prev;
+
+    while (ptr) {
+        TestFree(ptr->mode_name);
+        prev = ptr;
+        ptr = ptr->list.next;
+        free(prev);
+    }
+}
+
+static void
+xf86freeDisplayList(XF86ConfDisplayPtr ptr)
+{
+    XF86ConfDisplayPtr prev;
+
+    while (ptr) {
+        xf86freeModeList(ptr->disp_mode_lst);
+        xf86optionListFree(ptr->disp_option_lst);
+        prev = ptr;
+        ptr = ptr->list.next;
+        free(prev);
+    }
+}
+
 #define CLEANUP xf86freeDisplayList
 
 static XF86ConfDisplayPtr
@@ -433,6 +460,19 @@ xf86printScreenSection(FILE * cf, XF86ConfScreenPtr ptr)
 
 }
 
+static void
+xf86freeAdaptorLinkList(XF86ConfAdaptorLinkPtr ptr)
+{
+    XF86ConfAdaptorLinkPtr prev;
+
+    while (ptr) {
+        TestFree(ptr->al_adaptor_str);
+        prev = ptr;
+        ptr = ptr->list.next;
+        free(prev);
+    }
+}
+
 void
 xf86freeScreenList(XF86ConfScreenPtr ptr)
 {
@@ -454,46 +494,6 @@ xf86freeScreenList(XF86ConfScreenPtr ptr)
     }
 }
 
-void
-xf86freeAdaptorLinkList(XF86ConfAdaptorLinkPtr ptr)
-{
-    XF86ConfAdaptorLinkPtr prev;
-
-    while (ptr) {
-        TestFree(ptr->al_adaptor_str);
-        prev = ptr;
-        ptr = ptr->list.next;
-        free(prev);
-    }
-}
-
-void
-xf86freeDisplayList(XF86ConfDisplayPtr ptr)
-{
-    XF86ConfDisplayPtr prev;
-
-    while (ptr) {
-        xf86freeModeList(ptr->disp_mode_lst);
-        xf86optionListFree(ptr->disp_option_lst);
-        prev = ptr;
-        ptr = ptr->list.next;
-        free(prev);
-    }
-}
-
-void
-xf86freeModeList(XF86ModePtr ptr)
-{
-    XF86ModePtr prev;
-
-    while (ptr) {
-        TestFree(ptr->mode_name);
-        prev = ptr;
-        ptr = ptr->list.next;
-        free(prev);
-    }
-}
-
 int
 xf86validateScreen(XF86ConfigPtr p)
 {
diff --git a/hw/xfree86/parser/Vendor.c b/hw/xfree86/parser/Vendor.c
index 4f6e510..f137a4e 100644
--- a/hw/xfree86/parser/Vendor.c
+++ b/hw/xfree86/parser/Vendor.c
@@ -68,6 +68,22 @@ static xf86ConfigSymTabRec VendorSubTab[] = {
     {-1, ""},
 };
 
+static void
+xf86freeVendorSubList(XF86ConfVendSubPtr ptr)
+{
+    XF86ConfVendSubPtr prev;
+
+    while (ptr) {
+        TestFree(ptr->vs_identifier);
+        TestFree(ptr->vs_name);
+        TestFree(ptr->vs_comment);
+        xf86optionListFree(ptr->vs_option_lst);
+        prev = ptr;
+        ptr = ptr->list.next;
+        free(prev);
+    }
+}
+
 #define CLEANUP xf86freeVendorSubList
 
 static XF86ConfVendSubPtr
@@ -215,19 +231,3 @@ xf86freeVendorList(XF86ConfVendorPtr p)
     xf86optionListFree(p->vnd_option_lst);
     free(p);
 }
-
-void
-xf86freeVendorSubList(XF86ConfVendSubPtr ptr)
-{
-    XF86ConfVendSubPtr prev;
-
-    while (ptr) {
-        TestFree(ptr->vs_identifier);
-        TestFree(ptr->vs_name);
-        TestFree(ptr->vs_comment);
-        xf86optionListFree(ptr->vs_option_lst);
-        prev = ptr;
-        ptr = ptr->list.next;
-        free(prev);
-    }
-}
diff --git a/hw/xfree86/parser/configProcs.h b/hw/xfree86/parser/configProcs.h
index 774e2a2..e6c231e 100644
--- a/hw/xfree86/parser/configProcs.h
+++ b/hw/xfree86/parser/configProcs.h
@@ -55,12 +55,10 @@ int xf86validateInput(XF86ConfigPtr p);
 /* InputClass.c */
 XF86ConfInputClassPtr xf86parseInputClassSection(void);
 void xf86printInputClassSection(FILE * f, XF86ConfInputClassPtr ptr);
-void xf86freeInputClassList(XF86ConfInputClassPtr ptr);
 
 /* OutputClass.c */
 XF86ConfOutputClassPtr xf86parseOutputClassSection(void);
 void xf86printOutputClassSection(FILE * f, XF86ConfOutputClassPtr ptr);
-void xf86freeOutputClassList(XF86ConfOutputClassPtr ptr);
 
 /* Layout.c */
 XF86ConfLayoutPtr xf86parseLayoutSection(void);
@@ -92,16 +90,12 @@ XF86ConfInputPtr xf86parsePointerSection(void);
 XF86ConfScreenPtr xf86parseScreenSection(void);
 void xf86printScreenSection(FILE * cf, XF86ConfScreenPtr ptr);
 extern _X_EXPORT void xf86freeScreenList(XF86ConfScreenPtr ptr);
-void xf86freeAdaptorLinkList(XF86ConfAdaptorLinkPtr ptr);
-void xf86freeDisplayList(XF86ConfDisplayPtr ptr);
-void xf86freeModeList(XF86ModePtr ptr);
 int xf86validateScreen(XF86ConfigPtr p);
 
 /* Vendor.c */
 XF86ConfVendorPtr xf86parseVendorSection(void);
 void xf86freeVendorList(XF86ConfVendorPtr p);
 void xf86printVendorSection(FILE * cf, XF86ConfVendorPtr ptr);
-void xf86freeVendorSubList(XF86ConfVendSubPtr ptr);
 
 /* Video.c */
 XF86ConfVideoAdaptorPtr xf86parseVideoAdaptorSection(void);
-- 
2.4.1



More information about the xorg-devel mailing list