summaryrefslogtreecommitdiff
path: root/Panel.c
diff options
context:
space:
mode:
authorloderunner <loderunner@63cc0a6c-1f0e-0410-841e-f6a342073da8>2006-07-11 06:13:32 +0000
committerloderunner <loderunner@63cc0a6c-1f0e-0410-841e-f6a342073da8>2006-07-11 06:13:32 +0000
commitb82a6490e6c54c80071eeff004b5283c63a31971 (patch)
tree13a209d132be00e28d24f9ce750a873055cfbd98 /Panel.c
parent6695cb64e57789798efbac1f6c5d0bb46a621e9b (diff)
downloadhtop-b82a6490e6c54c80071eeff004b5283c63a31971.tar.gz
Performance improvement hackathon: improve process comparison routines,
disable useless code in release builds such as runtime type-checking on dynamic data structures and process fields that are not being computed, faster(?) method for verifying the process owner (still need to ensure correctness), don't destroy and create process objects for hidden kernel threads over and over. Phew. I shouldn't be doing all this today, but I could not resist. git-svn-id: svn://svn.code.sf.net/p/htop/code/trunk@44 63cc0a6c-1f0e-0410-841e-f6a342073da8
Diffstat (limited to 'Panel.c')
-rw-r--r--Panel.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/Panel.c b/Panel.c
index 081306c..fef7018 100644
--- a/Panel.c
+++ b/Panel.c
@@ -10,6 +10,7 @@ in the source distribution for its full text.
#include "Vector.h"
#include "CRT.h"
#include "RichString.h"
+#include "ListItem.h"
#include <math.h>
#include <stdbool.h>
@@ -54,12 +55,18 @@ struct Panel_ {
#define MAX(a,b) ((a)>(b)?(a):(b))
#endif
+#ifdef DEBUG
char* PANEL_CLASS = "Panel";
+#else
+#define PANEL_CLASS NULL
+#endif
+
-Panel* Panel_new(int x, int y, int w, int h, char* type, bool owner) {
+Panel* Panel_new(int x, int y, int w, int h, char* type, bool owner, Object_Compare compare) {
Panel* this;
this = malloc(sizeof(Panel));
Panel_init(this, x, y, w, h, type, owner);
+ this->items->compare = compare;
return this;
}
@@ -71,14 +78,14 @@ void Panel_delete(Object* cast) {
void Panel_init(Panel* this, int x, int y, int w, int h, char* type, bool owner) {
Object* super = (Object*) this;
- super->class = PANEL_CLASS;
+ Object_setClass(this, PANEL_CLASS);
super->delete = Panel_delete;
this->x = x;
this->y = y;
this->w = w;
this->h = h;
this->eventHandler = NULL;
- this->items = Vector_new(type, owner, DEFAULT_SIZE);
+ this->items = Vector_new(type, owner, DEFAULT_SIZE, ListItem_compare);
this->scrollV = 0;
this->scrollH = 0;
this->selected = 0;