mirror of https://github.com/xzeldon/htop.git
Settings: initialize default sort key for new screenpanel
Use C99 struct initialization, which also makes using calloc redundant. htop: Process.c:1179: int Process_compareByKey_Base(const Process *, const Process *, ProcessField): Assertion `0 && "Process_compareByKey_Base: default key reached"' failed.
This commit is contained in:
parent
fa9f260f63
commit
3cfdf66d9a
24
Settings.c
24
Settings.c
|
@ -263,16 +263,20 @@ static void ScreenSettings_readFields(ScreenSettings* ss, Hashtable* columns, co
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenSettings* Settings_newScreen(Settings* this, const char* name, const char* line) {
|
ScreenSettings* Settings_newScreen(Settings* this, const char* name, const char* line) {
|
||||||
ScreenSettings* ss = xCalloc(1, sizeof(ScreenSettings));
|
ScreenSettings* ss = xMalloc(sizeof(ScreenSettings));
|
||||||
ss->name = xStrdup(name);
|
*ss = (ScreenSettings) {
|
||||||
ss->fields = xCalloc(LAST_PROCESSFIELD, sizeof(ProcessField));
|
.name = xStrdup(name),
|
||||||
ss->flags = 0;
|
.fields = xCalloc(LAST_PROCESSFIELD, sizeof(ProcessField)),
|
||||||
ss->direction = 1;
|
.flags = 0,
|
||||||
ss->treeDirection = 1;
|
.direction = 1,
|
||||||
ss->treeSortKey = 1;
|
.treeDirection = 1,
|
||||||
ss->treeView = false;
|
.sortKey = PID,
|
||||||
ss->treeViewAlwaysByPID = false;
|
.treeSortKey = PID,
|
||||||
ss->allBranchesCollapsed = false;
|
.treeView = false,
|
||||||
|
.treeViewAlwaysByPID = false,
|
||||||
|
.allBranchesCollapsed = false,
|
||||||
|
};
|
||||||
|
|
||||||
ScreenSettings_readFields(ss, this->dynamicColumns, line);
|
ScreenSettings_readFields(ss, this->dynamicColumns, line);
|
||||||
this->screens[this->nScreens] = ss;
|
this->screens[this->nScreens] = ss;
|
||||||
this->nScreens++;
|
this->nScreens++;
|
||||||
|
|
Loading…
Reference in New Issue