summaryrefslogtreecommitdiffstats
path: root/ListItem.c
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2021-08-31 15:38:52 +1000
committerNathan Scott <nathans@redhat.com>2021-12-07 17:04:49 +1100
commit72ba20fa5f077bab4286dd78f9944df15de3b3b4 (patch)
tree0c4fb4e63b80b3a20d5f50bdac6bed9fe2bee607 /ListItem.c
parentff4f44b22ae8d6522ee22599174a6cdd41bc0314 (diff)
Introduce screen tabs
This is a forward port (by nathans) of Hisham's original code.
Diffstat (limited to 'ListItem.c')
-rw-r--r--ListItem.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/ListItem.c b/ListItem.c
index 9161a1cc..246bc5d0 100644
--- a/ListItem.c
+++ b/ListItem.c
@@ -18,13 +18,13 @@ in the source distribution for its full text.
#include "XUtils.h"
-static void ListItem_delete(Object* cast) {
+void ListItem_delete(Object* cast) {
ListItem* this = (ListItem*)cast;
free(this->value);
free(this);
}
-static void ListItem_display(const Object* cast, RichString* out) {
+void ListItem_display(const Object* cast, RichString* out) {
const ListItem* const this = (const ListItem*)cast;
assert (this != NULL);
@@ -38,11 +38,15 @@ static void ListItem_display(const Object* cast, RichString* out) {
RichString_appendWide(out, CRT_colors[DEFAULT_COLOR], this->value);
}
-ListItem* ListItem_new(const char* value, int key) {
- ListItem* this = AllocThis(ListItem);
+void ListItem_init(ListItem* this, const char* value, int key) {
this->value = xStrdup(value);
this->key = key;
this->moving = false;
+}
+
+ListItem* ListItem_new(const char* value, int key) {
+ ListItem* this = AllocThis(ListItem);
+ ListItem_init(this, value, key);
return this;
}
@@ -55,7 +59,7 @@ void ListItem_append(ListItem* this, const char* text) {
this->value[newLen] = '\0';
}
-static int ListItem_compare(const void* cast1, const void* cast2) {
+int ListItem_compare(const void* cast1, const void* cast2) {
const ListItem* obj1 = (const ListItem*) cast1;
const ListItem* obj2 = (const ListItem*) cast2;
return strcmp(obj1->value, obj2->value);

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