diff options
author | Adam Jackson <ajax@redhat.com> | 2014-10-22 10:38:11 -0400 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2015-07-08 16:40:57 -0400 |
commit | 91f0d71c18254746e1d519f0d19d11f756a9588c (patch) | |
tree | eeaac64887ae86dc84eabfbdbfdcc6bc9b1fbbd2 /hw | |
parent | c732bb2799ad7ff6b0cdd9c65487466e6a9b76e7 (diff) |
parser: static cleanup
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xfree86/parser/InputClass.c | 152 | ||||
-rw-r--r-- | hw/xfree86/parser/OutputClass.c | 52 | ||||
-rw-r--r-- | hw/xfree86/parser/Screen.c | 80 | ||||
-rw-r--r-- | hw/xfree86/parser/Vendor.c | 32 | ||||
-rw-r--r-- | 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 c2fbd22a7..29bd9fa64 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 7e9a8ac1a..3f2082ecb 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 b5b454ff4..47319706f 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,28 +460,7 @@ xf86printScreenSection(FILE * cf, XF86ConfScreenPtr ptr) } -void -xf86freeScreenList(XF86ConfScreenPtr ptr) -{ - XF86ConfScreenPtr prev; - int i; - while (ptr) { - TestFree(ptr->scrn_identifier); - TestFree(ptr->scrn_monitor_str); - TestFree(ptr->scrn_device_str); - for (i = 0; i < ptr->num_gpu_devices; i++) - TestFree(ptr->scrn_gpu_device_str[i]); - TestFree(ptr->scrn_comment); - xf86optionListFree(ptr->scrn_option_lst); - xf86freeAdaptorLinkList(ptr->scrn_adaptor_lst); - xf86freeDisplayList(ptr->scrn_display_lst); - prev = ptr; - ptr = ptr->list.next; - free(prev); - } -} - -void +static void xf86freeAdaptorLinkList(XF86ConfAdaptorLinkPtr ptr) { XF86ConfAdaptorLinkPtr prev; @@ -468,26 +474,20 @@ xf86freeAdaptorLinkList(XF86ConfAdaptorLinkPtr ptr) } 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) +xf86freeScreenList(XF86ConfScreenPtr ptr) { - XF86ModePtr prev; - + XF86ConfScreenPtr prev; + int i; while (ptr) { - TestFree(ptr->mode_name); + TestFree(ptr->scrn_identifier); + TestFree(ptr->scrn_monitor_str); + TestFree(ptr->scrn_device_str); + for (i = 0; i < ptr->num_gpu_devices; i++) + TestFree(ptr->scrn_gpu_device_str[i]); + TestFree(ptr->scrn_comment); + xf86optionListFree(ptr->scrn_option_lst); + xf86freeAdaptorLinkList(ptr->scrn_adaptor_lst); + xf86freeDisplayList(ptr->scrn_display_lst); prev = ptr; ptr = ptr->list.next; free(prev); diff --git a/hw/xfree86/parser/Vendor.c b/hw/xfree86/parser/Vendor.c index 4f6e510bb..f137a4eb9 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 774e2a2da..e6c231e2d 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); |