mirror of https://github.com/xzeldon/htop.git
InfoScreen/ProcessList: do not access Vector internals
Use wrapper function to encapsulate the Vector structure
This commit is contained in:
parent
3f99c2de24
commit
d37d66bb3a
|
@ -28,7 +28,7 @@ InfoScreen* InfoScreen_init(InfoScreen* this, const Process* process, FunctionBa
|
||||||
}
|
}
|
||||||
this->display = Panel_new(0, 1, COLS, height, Class(ListItem), false, bar);
|
this->display = Panel_new(0, 1, COLS, height, Class(ListItem), false, bar);
|
||||||
this->inc = IncSet_new(bar);
|
this->inc = IncSet_new(bar);
|
||||||
this->lines = Vector_new(this->display->items->type, true, DEFAULT_SIZE);
|
this->lines = Vector_new(Vector_type(this->display->items), true, DEFAULT_SIZE);
|
||||||
Panel_setHeader(this->display, panelHeader);
|
Panel_setHeader(this->display, panelHeader);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,7 +202,7 @@ static void ProcessList_updateTreeSetLayer(ProcessList* this, unsigned int leftB
|
||||||
if (layerSize == 0)
|
if (layerSize == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Vector* layer = Vector_new(this->processes->type, false, layerSize);
|
Vector* layer = Vector_new(Vector_type(this->processes), false, layerSize);
|
||||||
|
|
||||||
// Find all processes on the same layer (process with the same `deep` value
|
// Find all processes on the same layer (process with the same `deep` value
|
||||||
// and included in a range from `leftBound` to `rightBound`).
|
// and included in a range from `leftBound` to `rightBound`).
|
||||||
|
|
4
Vector.h
4
Vector.h
|
@ -68,6 +68,10 @@ static inline int Vector_size(const Vector* this) {
|
||||||
|
|
||||||
#endif /* NDEBUG */
|
#endif /* NDEBUG */
|
||||||
|
|
||||||
|
static inline const ObjectClass* Vector_type(const Vector* this) {
|
||||||
|
return this->type;
|
||||||
|
}
|
||||||
|
|
||||||
void Vector_add(Vector* this, void* data_);
|
void Vector_add(Vector* this, void* data_);
|
||||||
|
|
||||||
int Vector_indexOf(const Vector* this, const void* search_, Object_Compare compare);
|
int Vector_indexOf(const Vector* this, const void* search_, Object_Compare compare);
|
||||||
|
|
Loading…
Reference in New Issue