summaryrefslogtreecommitdiff
path: root/src/fe-text/textbuffer.h
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-07-12 21:44:01 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-07-12 21:44:01 +0000
commit9eed52fa40664819c39fa264cc4b15ea06f9b4e5 (patch)
treec8c66e44d0144829fa941ab82d7a983b7fe400d1 /src/fe-text/textbuffer.h
parentdd37b9ca2c5ea17349a76d96c05eecaa10287d95 (diff)
downloadirssi-9eed52fa40664819c39fa264cc4b15ea06f9b4e5.zip
Replaced GList by adding prev/next pointers to LINE_REC. This should make
some things faster and take a bit less memory. Also fixed an evil memory leak. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1611 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-text/textbuffer.h')
-rw-r--r--src/fe-text/textbuffer.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/fe-text/textbuffer.h b/src/fe-text/textbuffer.h
index 21f70e26..ddbfd72c 100644
--- a/src/fe-text/textbuffer.h
+++ b/src/fe-text/textbuffer.h
@@ -1,10 +1,6 @@
#ifndef __TEXTBUFFER_H
#define __TEXTBUFFER_H
-/* FIXME: Textbuffer code gets a lot faster in some points when I get rid of
- GList and make prev/next pointers directly in LINE_REC. However, this
- can still wait for a while until I get rid of GList entirely everywhere. */
-
#define LINE_TEXT_CHUNK_SIZE 16384
enum {
@@ -27,13 +23,15 @@ typedef struct {
time_t time;
} LINE_INFO_REC;
-typedef struct {
+typedef struct _LINE_REC {
/* text in the line. \0 means that the next char will be a
color or command. <= 127 = color or if 8. bit is set, the
first 7 bits are the command. See LINE_CMD_xxxx.
DO NOT ADD BLACK WITH \0\0 - this will break things. Use
LINE_CMD_COLOR0 instead. */
+ struct _LINE_REC *prev, *next;
+
unsigned char *text;
unsigned char refcount;
LINE_INFO_REC info;
@@ -47,7 +45,7 @@ typedef struct {
typedef struct {
GSList *text_chunks;
- GList *lines;
+ LINE_REC *first_line;
int lines_count;
LINE_REC *cur_line;
@@ -65,6 +63,9 @@ void textbuffer_line_ref(LINE_REC *line);
void textbuffer_line_unref(TEXT_BUFFER_REC *buffer, LINE_REC *line);
void textbuffer_line_unref_list(TEXT_BUFFER_REC *buffer, GList *list);
+LINE_REC *textbuffer_line_last(TEXT_BUFFER_REC *buffer);
+int textbuffer_line_exists_after(LINE_REC *line, LINE_REC *search);
+
/* Append text to buffer. When \0<EOL> is found at the END OF DATA, a new
line is created. You must send the EOL command before you can do anything
else with the buffer. */