aboutsummaryrefslogtreecommitdiff
path: root/games/RetroArch/etc.patch
blob: f473103775b9fba77234a0e691ed84c0bad74c09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
Author: orbea <orbea@fredslev.dk>
Date:   Fri Aug 31 08:25:16 2018 -0700

    Revert "sort config file variables"
    
    This reverts commit 62e89974afbb6628344fb084c50712bfab4419de.
    
      Conflicts:
            libretro-common/file/config_file.c

diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c
index 9c2b76b170..15ce4336d1 100644
--- a/libretro-common/file/config_file.c
+++ b/libretro-common/file/config_file.c
@@ -68,84 +68,6 @@ struct config_include_list
 static config_file_t *config_file_new_internal(
       const char *path, unsigned depth);
 
-static int config_sort_compare_func(struct config_entry_list *a,
-      struct config_entry_list *b)
-{
-   const char *a_key = a ? a->key : NULL;
-   const char *b_key = b ? b->key : NULL;
-
-   if (!a_key || !b_key)
-      return 0;
-
-   return strcasecmp(a_key, b_key);
-}
-
-/* https://stackoverflow.com/questions/7685/merge-sort-a-linked-list */
-static struct config_entry_list* merge_sort_linked_list(struct config_entry_list *list, int (*compare)(struct config_entry_list *one,struct config_entry_list *two))
-{
-   struct config_entry_list
-         *right  = list,
-         *temp   = list,
-         *last   = list,
-         *result = 0,
-         *next   = 0,
-         *tail   = 0;
-
-   /* Trivial case. */
-   if (!list || !list->next)
-      return list;
-
-   /* Find halfway through the list (by running two pointers, one at twice the speed of the other). */
-   while (temp && temp->next)
-   {
-      last = right;
-      right = right->next;
-      temp = temp->next->next;
-   }
-
-   /* Break the list in two. (prev pointers are broken here, but we fix later) */
-   last->next = 0;
-
-   /* Recurse on the two smaller lists: */
-   list = merge_sort_linked_list(list, compare);
-   right = merge_sort_linked_list(right, compare);
-
-   /* Merge: */
-   while (list || right)
-   {
-      /* Take from empty lists, or compare: */
-      if (!right)
-      {
-         next = list;
-         list = list->next;
-      }
-      else if (!list)
-      {
-         next = right;
-         right = right->next;
-      }
-      else if (compare(list, right) < 0)
-      {
-         next = list;
-         list = list->next;
-      }
-      else
-      {
-         next = right;
-         right = right->next;
-      }
-
-      if (!result)
-         result = next;
-      else
-         tail->next = next;
-
-      tail = next;
-   }
-
-   return result;
-}
-
 static char *strip_comment(char *str)
 {
    /* Remove everything after comment.
@@ -998,7 +920,7 @@ void config_file_dump(config_file_t *conf, FILE *file)
       includes = includes->next;
    }
 
-   list = merge_sort_linked_list((struct config_entry_list*)conf->entries, config_sort_compare_func);
+   list = (struct config_entry_list*)conf->entries;
 
    while (list)
    {