about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-07-19 17:14:04 +0100
committerJames Booth <boothj5@gmail.com>2014-07-19 17:14:04 +0100
commitb125fa0febed133213c107a291e856deb760b58e (patch)
tree131716f94e0dd23f7fb412e8590060d53277b622 /src
parent191b910d6e9358aca25f5b1b36983f2128743680 (diff)
downloadprofani-tty-b125fa0febed133213c107a291e856deb760b58e.tar.gz
Return address of buffer entry
Diffstat (limited to 'src')
-rw-r--r--src/ui/buffer.c5
-rw-r--r--src/ui/buffer.h2
-rw-r--r--src/ui/window.c4
3 files changed, 5 insertions, 6 deletions
diff --git a/src/ui/buffer.c b/src/ui/buffer.c
index 903d0662..5ec68bd2 100644
--- a/src/ui/buffer.c
+++ b/src/ui/buffer.c
@@ -69,12 +69,11 @@ buffer_push(ProfBuff buffer, const char show_char, const char * const date_fmt,
     buffer->entries = g_slist_append(buffer->entries, e);
 }
 
-ProfBuffEntry
+ProfBuffEntry*
 buffer_yield_entry(ProfBuff buffer, int entry)
 {
     GSList *node = g_slist_nth(buffer->entries, entry);
-    ProfBuffEntry *buff_entry = node->data;
-    return *buff_entry;
+    return node->data;
 }
 
 static void
diff --git a/src/ui/buffer.h b/src/ui/buffer.h
index 24bdac84..c9d1ccdc 100644
--- a/src/ui/buffer.h
+++ b/src/ui/buffer.h
@@ -18,5 +18,5 @@ ProfBuff buffer_create();
 void buffer_free(ProfBuff buffer);
 void buffer_push(ProfBuff buffer, const char show_char, const char * const date_fmt, int flags, int attrs, const char * const from, const char * const message);
 int buffer_size(ProfBuff buffer);
-ProfBuffEntry buffer_yield_entry(ProfBuff buffer, int entry);
+ProfBuffEntry* buffer_yield_entry(ProfBuff buffer, int entry);
 #endif
diff --git a/src/ui/window.c b/src/ui/window.c
index 9081e271..d50f7bce 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -423,7 +423,7 @@ win_redraw(ProfWin *window)
     size = buffer_size(window->buffer);
 
     for (i = 0; i < size; i++) {
-        ProfBuffEntry e = buffer_yield_entry(window->buffer, i);
-        win_print(window, e.show_char, e.date_fmt, e.flags, e.attrs, e.from, e.message);
+        ProfBuffEntry *e = buffer_yield_entry(window->buffer, i);
+        win_print(window, e->show_char, e->date_fmt, e->flags, e->attrs, e->from, e->message);
     }
 }