mirror of https://github.com/xzeldon/htop.git
simplify code
This commit is contained in:
parent
1e124da059
commit
a20ba78b5e
|
@ -52,14 +52,12 @@ FunctionBar* FunctionBar_new(char** functions, char** keys, int* events) {
|
||||||
this->functions = malloc(sizeof(char*) * 15);
|
this->functions = malloc(sizeof(char*) * 15);
|
||||||
this->keys = malloc(sizeof(char*) * 15);
|
this->keys = malloc(sizeof(char*) * 15);
|
||||||
this->events = malloc(sizeof(int) * 15);
|
this->events = malloc(sizeof(int) * 15);
|
||||||
int i = 0;
|
for (int i = 0; i < 15 && functions[i]; i++) {
|
||||||
while (i < 15 && functions[i]) {
|
|
||||||
this->functions[i] = String_copy(functions[i]);
|
this->functions[i] = String_copy(functions[i]);
|
||||||
this->keys[i] = String_copy(keys[i]);
|
this->keys[i] = String_copy(keys[i]);
|
||||||
this->events[i] = events[i];
|
this->events[i] = events[i];
|
||||||
i++;
|
|
||||||
}
|
|
||||||
this->size = i;
|
this->size = i;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this->staticData = true;
|
this->staticData = true;
|
||||||
this->functions = functions ? functions : FunctionBar_FLabels;
|
this->functions = functions ? functions : FunctionBar_FLabels;
|
||||||
|
|
Loading…
Reference in New Issue