1
0
mirror of https://github.com/irssi/irssi.git synced 2024-10-13 05:03:45 -04:00

reverse queue

This commit is contained in:
ailin-nemui 2018-11-09 11:32:00 +01:00
parent 1e2547eb92
commit 4537d85b0b
2 changed files with 4 additions and 4 deletions

View File

@ -63,7 +63,7 @@ void rawlog_destroy(RAWLOG_REC *rawlog)
static void rawlog_add(RAWLOG_REC *rawlog, char *str) static void rawlog_add(RAWLOG_REC *rawlog, char *str)
{ {
if (rawlog->lines->length >= rawlog_lines && rawlog_lines > 0) { if (rawlog->lines->length >= rawlog_lines && rawlog_lines > 0) {
void *tmp = g_queue_pop_tail(rawlog->lines); void *tmp = g_queue_pop_head(rawlog->lines);
g_free(tmp); g_free(tmp);
} }
@ -72,7 +72,7 @@ static void rawlog_add(RAWLOG_REC *rawlog, char *str)
write_buffer(rawlog->handle, "\n", 1); write_buffer(rawlog->handle, "\n", 1);
} }
g_queue_push_head(rawlog->lines, str); g_queue_push_tail(rawlog->lines, str);
signal_emit_id(signal_rawlog, 2, rawlog, str); signal_emit_id(signal_rawlog, 2, rawlog, str);
} }
@ -105,7 +105,7 @@ static void rawlog_dump(RAWLOG_REC *rawlog, int f)
GList *tmp; GList *tmp;
ssize_t ret = 0; ssize_t ret = 0;
for (tmp = rawlog->lines->tail; ret != -1 && tmp != NULL; tmp = tmp->prev) { for (tmp = rawlog->lines->head; ret != -1 && tmp != NULL; tmp = tmp->next) {
ret = write(f, tmp->data, strlen((char *) tmp->data)); ret = write(f, tmp->data, strlen((char *) tmp->data));
if (ret != -1) if (ret != -1)
ret = write(f, "\n", 1); ret = write(f, "\n", 1);

View File

@ -21,7 +21,7 @@ rawlog_get_lines(rawlog)
PREINIT: PREINIT:
GList *tmp; GList *tmp;
PPCODE: PPCODE:
for (tmp = rawlog->lines->tail; tmp != NULL; tmp = tmp->prev) { for (tmp = rawlog->lines->head; tmp != NULL; tmp = tmp->next) {
XPUSHs(sv_2mortal(new_pv(tmp->data))); XPUSHs(sv_2mortal(new_pv(tmp->data)));
} }