You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
3.2 KiB
72 lines
3.2 KiB
Index: FunctionBar.c
|
|
===================================================================
|
|
--- FunctionBar.c (revision 162)
|
|
+++ FunctionBar.c (working copy)
|
|
@@ -52,12 +52,14 @@ FunctionBar* FunctionBar_new(char** func
|
|
this->functions = malloc(sizeof(char*) * 15);
|
|
this->keys = malloc(sizeof(char*) * 15);
|
|
this->events = malloc(sizeof(int) * 15);
|
|
- int i = 0;
|
|
- while (i < 15 && functions[i]) {
|
|
+ int i;
|
|
+ for (i = 0; i < 15; i++) {
|
|
+ if (functions[i] == NULL) /* We don't know the size of the array, */
|
|
+ break; /* so let's assume it is NULL terminated */
|
|
+ /* and break if we find that NULL */
|
|
this->functions[i] = String_copy(functions[i]);
|
|
this->keys[i] = String_copy(keys[i]);
|
|
this->events[i] = events[i];
|
|
- i++;
|
|
}
|
|
this->size = i;
|
|
} else {
|
|
Index: htop.c
|
|
===================================================================
|
|
--- htop.c (revision 162)
|
|
+++ htop.c (working copy)
|
|
@@ -151,7 +151,7 @@ static void showHelp(ProcessList* pl) {
|
|
clear();
|
|
}
|
|
|
|
-static char* CategoriesFunctions[10] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done "};
|
|
+static char* CategoriesFunctions[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done ", NULL};
|
|
|
|
static void Setup_run(Settings* settings, int headerHeight) {
|
|
ScreenManager* scr = ScreenManager_new(0, headerHeight, 0, -1, HORIZONTAL, true);
|
|
@@ -190,7 +190,7 @@ static HandlerResult pickWithEnter(Panel
|
|
}
|
|
|
|
static Object* pickFromVector(Panel* panel, Panel* list, int x, int y, char** keyLabels, FunctionBar* prevBar) {
|
|
- char* fuKeys[2] = {"Enter", "Esc"};
|
|
+ char* fuKeys[] = {"Enter", "Esc", NULL};
|
|
int fuEvents[2] = {13, 27};
|
|
if (!list->eventHandler)
|
|
Panel_setEventHandler(list, pickWithEnter);
|
|
@@ -326,7 +326,7 @@ int main(int argc, char** argv) {
|
|
Panel_setRichHeader(panel, ProcessList_printHeader(pl));
|
|
|
|
char* searchFunctions[] = {"Next ", "Exit ", " Search: ", NULL};
|
|
- char* searchKeys[] = {"F3", "Esc", " "};
|
|
+ char* searchKeys[] = {"F3", "Esc", " ", NULL};
|
|
int searchEvents[] = {KEY_F(3), 27, ERR};
|
|
FunctionBar* searchBar = FunctionBar_new(searchFunctions, searchKeys, searchEvents);
|
|
|
|
@@ -656,7 +656,7 @@ int main(int argc, char** argv) {
|
|
|
|
Panel* affinityPanel = AffinityPanel_new(pl->processorCount, curr);
|
|
|
|
- char* fuFunctions[2] = {"Set ", "Cancel "};
|
|
+ char* fuFunctions[3] = {"Set ", "Cancel ", NULL};
|
|
void* set = pickFromVector(panel, affinityPanel, 15, headerHeight, fuFunctions, defaultBar);
|
|
if (set) {
|
|
unsigned long new = AffinityPanel_getAffinity(affinityPanel);
|
|
@@ -695,7 +695,7 @@ int main(int argc, char** argv) {
|
|
{
|
|
Panel* sortPanel = Panel_new(0, 0, 0, 0, LISTITEM_CLASS, true, ListItem_compare);
|
|
Panel_setHeader(sortPanel, "Sort by");
|
|
- char* fuFunctions[2] = {"Sort ", "Cancel "};
|
|
+ char* fuFunctions[] = {"Sort ", "Cancel ", NULL};
|
|
ProcessField* fields = pl->fields;
|
|
for (int i = 0; fields[i]; i++) {
|
|
char* name = String_trim(Process_fieldTitles[fields[i]]);
|