1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Return address of buffer entry

This commit is contained in:
James Booth 2014-07-19 17:14:04 +01:00
parent 191b910d6e
commit b125fa0feb
3 changed files with 5 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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);
}
}