Permalink
Browse files

buffer_line are TAILQ now

  • Loading branch information...
1 parent 807a314 commit edbc1f58b18399a960cbaa1d2330bbbe3ccf2344 @xorg62 committed Feb 28, 2012
Showing with 13 additions and 13 deletions.
  1. +2 −2 src/hftirc.c
  2. +3 −3 src/hftirc.h
  3. +8 −8 src/ui.c
View
@@ -30,7 +30,7 @@ main(int argc, char **argv)
struct session *session;
struct session_info *info;
fd_set set;
- int i, n, maxfd, nsession;
+ int i, maxfd, nsession;
while((i = getopt(argc, argv, "hvc:")) != -1)
{
@@ -86,7 +86,7 @@ main(int argc, char **argv)
++nsession;
}
- if(select(maxfd + n + 1, &set, NULL, NULL, &tv) > 0)
+ if(select(maxfd + nsession + 1, &set, NULL, NULL, &tv) > 0)
{
if(FD_ISSET(STDIN_FILENO, &set))
ui_get_input();
View
@@ -21,7 +21,7 @@
#include <wctype.h>
#if !defined (__NetBSD__)
- #include <ncurses.h>
+ #include <ncursesw.h>
#else
#include <ncurses/ncurses.h>
#endif
@@ -71,7 +71,7 @@ struct buffer_line
{
char *line;
int id;
- STAILQ_ENTRY(buffer_line) next;
+ TAILQ_ENTRY(buffer_line) next;
};
struct buffer
@@ -84,7 +84,7 @@ struct buffer
int act, nline;
char *name;
char *topic;
- STAILQ_HEAD(, buffer_line) lines;
+ TAILQ_HEAD(blsub, buffer_line) lines;
SLIST_HEAD(, nick) nicks;
TAILQ_ENTRY(buffer) next;
};
View
@@ -24,7 +24,7 @@ ui_buffer_new(struct session *session, char *name)
b->id = (p ? p->id + 1 : 0);
b->nline = 0;
- STAILQ_INIT(&b->lines);
+ TAILQ_INIT(&b->lines);
SLIST_INIT(&b->nicks);
TAILQ_INSERT_TAIL(&H.h.buffer, b, next);
@@ -40,10 +40,10 @@ ui_buffer_remove(struct buffer *b)
free(b->name);
free(b->topic);
- while(!STAILQ_EMPTY(&b->lines))
+ while(!TAILQ_EMPTY(&b->lines))
{
- bl = STAILQ_FIRST(&b->lines);
- STAILQ_REMOVE_HEAD(&b->lines, next);
+ bl = TAILQ_FIRST(&b->lines);
+ TAILQ_REMOVE(&b->lines, bl, next);
free(bl->line);
free(bl);
}
@@ -173,7 +173,7 @@ ui_update_buf(void)
werase(H.ui.mainwin);
- STAILQ_FOREACH(b, &H.bufsel->lines, next)
+ TAILQ_FOREACH(b, &H.bufsel->lines, next)
ui_print_line(b);
wrefresh(H.ui.mainwin);
@@ -188,13 +188,13 @@ ui_buffer_line_new(struct buffer *b, char *str)
bl->line = str;
bl->id = b->nline++;
- STAILQ_INSERT_TAIL(&b->lines, bl, next);
+ TAILQ_INSERT_TAIL(&b->lines, bl, next);
/* Remove head if histo length is reached */
if(b->nline >= BUFHISTOLEN)
{
- h = STAILQ_FIRST(&b->lines);
- STAILQ_REMOVE_HEAD(&b->lines, next);
+ h = TAILQ_FIRST(&b->lines);
+ TAILQ_REMOVE(&b->lines, h, next);
free(h->line);
free(h);
--b->nline;

0 comments on commit edbc1f5

Please sign in to comment.