From d03d6e606b40157d910ddf99ab018156abeb8ef0 Mon Sep 17 00:00:00 2001 From: "berkeviktor@aol.com" Date: Mon, 28 Feb 2011 18:59:32 +0100 Subject: add wdk changes to named branch --- src/common/text.c | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) (limited to 'src/common/text.c') diff --git a/src/common/text.c b/src/common/text.c index a2198517..fcde5870 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -19,13 +19,11 @@ #include #include #include -#include #include #include #include #include #include -#include #include "xchat.h" #include @@ -271,9 +269,6 @@ scrollback_load (session *sess) char *text; time_t stamp; int lines; - char *map, *end_map; - struct stat statbuf; - const char *begin, *eol; if (sess->text_scrollback == SET_DEFAULT) { @@ -293,32 +288,9 @@ scrollback_load (session *sess) if (fh == -1) return; - if (fstat (fh, &statbuf) < 0) - return; - - map = mmap (NULL, statbuf.st_size, PROT_READ, MAP_PRIVATE, fh, 0); - if (map == MAP_FAILED) - return; - - end_map = map + statbuf.st_size; - lines = 0; - begin = map; - while (begin < end_map) + while (waitline (fh, buf, sizeof buf, FALSE) != -1) { - int n_bytes; - - eol = memchr (begin, '\n', end_map - begin); - - if (!eol) - eol = end_map; - - n_bytes = MIN (eol - begin, sizeof (buf) - 1); - - strncpy (buf, begin, n_bytes); - - buf[n_bytes] = 0; - if (buf[0] == 'T') { if (sizeof (time_t) == 4) @@ -334,8 +306,6 @@ scrollback_load (session *sess) } lines++; } - - begin = eol + 1; } sess->scrollwritten = lines; @@ -349,7 +319,6 @@ scrollback_load (session *sess) /*EMIT_SIGNAL (XP_TE_GENMSG, sess, "*", buf, NULL, NULL, NULL, 0);*/ } - munmap (map, statbuf.st_size); close (fh); } -- cgit 1.4.1