summaryrefslogtreecommitdiffstats
path: root/ListItem.c
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2006-07-11 06:13:32 +0000
committerHisham Muhammad <hisham@gobolinux.org>2006-07-11 06:13:32 +0000
commit5d48ab8c28925f892e8e7f432f7d2b78c86e95c5 (patch)
tree13a209d132be00e28d24f9ce750a873055cfbd98 /ListItem.c
parent4c41e78bbfe34c67db16bbce8e0241ba583e8572 (diff)
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.
Diffstat (limited to 'ListItem.c')
-rw-r--r--ListItem.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ListItem.c b/ListItem.c
index 13d94d00..90107e4b 100644
--- a/ListItem.c
+++ b/ListItem.c
@@ -23,14 +23,17 @@ typedef struct ListItem_ {
}*/
+#ifdef DEBUG
char* LISTITEM_CLASS = "ListItem";
+#else
+#define LISTITEM_CLASS NULL
+#endif
ListItem* ListItem_new(char* value, int key) {
ListItem* this = malloc(sizeof(ListItem));
- ((Object*)this)->class = LISTITEM_CLASS;
+ Object_setClass(this, LISTITEM_CLASS);
((Object*)this)->display = ListItem_display;
((Object*)this)->delete = ListItem_delete;
- ((Object*)this)->compare = ListItem_compare;
this->value = String_copy(value);
this->key = key;
return this;
@@ -62,7 +65,7 @@ const char* ListItem_getRef(ListItem* this) {
return this->value;
}
-int ListItem_compare(const Object* cast1, const Object* cast2) {
+int ListItem_compare(const void* cast1, const void* cast2) {
ListItem* obj1 = (ListItem*) cast1;
ListItem* obj2 = (ListItem*) cast2;
return strcmp(obj1->value, obj2->value);

© 2014-2024 Faster IT GmbH | imprint | privacy policy