MCPcopy Create free account
hub / github.com/devkitPro/3ds-hbmenu / menuSort

Function menuSort

source/menu-list.c:89–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89static void menuSort(void)
90{
91 int i;
92 menu_s* m = &s_menu[!s_curMenu];
93 int nEntries = m->nEntries;
94 if (nEntries==0) return;
95
96 menuEntry_s** list = (menuEntry_s**)calloc(nEntries, sizeof(menuEntry_s*));
97 if(list == NULL) return;
98
99 menuEntry_s* p = m->firstEntry;
100 for(i = 0; i < nEntries; ++i) {
101 list[i] = p;
102 p = p->next;
103 }
104
105 qsort(list, nEntries, sizeof(menuEntry_s*), menuEntryCmp);
106
107 menuEntry_s** pp = &m->firstEntry;
108 for(i = 0; i < nEntries; ++i) {
109 *pp = list[i];
110 pp = &(*pp)->next;
111 }
112 m->lastEntry = list[nEntries-1];
113 *pp = NULL;
114
115 free(list);
116}
117
118int menuFileAssocScan(const char* target)
119{

Callers 2

menuScanFunction · 0.85
menuToggleStarFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected