summaryrefslogtreecommitdiffstats
path: root/ListItem.c
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2012-11-10 00:31:37 +0000
committerHisham Muhammad <hisham@gobolinux.org>2012-11-10 00:31:37 +0000
commit2a73405cd060b543d56987650327b18078a137d7 (patch)
tree3f20c358aea5787d4ea79d52c08d0bd591751def /ListItem.c
parent259e1a29384003c0c4ac6c84a499c0e05f789a90 (diff)
search and filter for the strace and lsof screens!
Diffstat (limited to 'ListItem.c')
-rw-r--r--ListItem.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/ListItem.c b/ListItem.c
index 9beed0cb..af50ca95 100644
--- a/ListItem.c
+++ b/ListItem.c
@@ -41,10 +41,12 @@ static void ListItem_delete(Object* cast) {
static void ListItem_display(Object* cast, RichString* out) {
ListItem* this = (ListItem*)cast;
assert (this != NULL);
+ /*
int len = strlen(this->value)+1;
char buffer[len+1];
snprintf(buffer, len, "%s", this->value);
- RichString_write(out, CRT_colors[DEFAULT_COLOR], buffer);
+ */
+ RichString_write(out, CRT_colors[DEFAULT_COLOR], this->value/*buffer*/);
}
ListItem* ListItem_new(const char* value, int key) {
@@ -57,11 +59,13 @@ ListItem* ListItem_new(const char* value, int key) {
return this;
}
-void ListItem_append(ListItem* this, char* text) {
- char* buf = malloc(strlen(this->value) + strlen(text) + 1);
- sprintf(buf, "%s%s", this->value, text);
- free(this->value);
- this->value = buf;
+void ListItem_append(ListItem* this, const char* text) {
+ int oldLen = strlen(this->value);
+ int textLen = strlen(text);
+ int newLen = strlen(this->value) + textLen;
+ this->value = realloc(this->value, newLen + 1);
+ memcpy(this->value + oldLen, text, textLen);
+ this->value[newLen] = '\0';
}
const char* ListItem_getRef(ListItem* this) {

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