summaryrefslogtreecommitdiff
path: root/src/fe-text/textbuffer.c
diff options
context:
space:
mode:
authorJilles Tjoelker <jilles@irssi.org>2008-11-01 17:56:56 +0000
committerjilles <jilles@dbcabf3a-b0e7-0310-adc4-f8d773084564>2008-11-01 17:56:56 +0000
commitaa39fba88d96f1fce6b95f31f96ee902112a0169 (patch)
tree00abdd131ad514cf6dd87cfdb6b5bc2cefd46ed2 /src/fe-text/textbuffer.c
parent875adf35a0f2da089662da42dd1cf44474527064 (diff)
downloadirssi-aa39fba88d96f1fce6b95f31f96ee902112a0169.zip
Remove the refcount on LINE_REC.
It seems to have no clear purpose. git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@4879 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-text/textbuffer.c')
-rw-r--r--src/fe-text/textbuffer.c41
1 files changed, 4 insertions, 37 deletions
diff --git a/src/fe-text/textbuffer.c b/src/fe-text/textbuffer.c
index fc016ff9..4cccb924 100644
--- a/src/fe-text/textbuffer.c
+++ b/src/fe-text/textbuffer.c
@@ -183,7 +183,6 @@ static LINE_REC *textbuffer_line_create(TEXT_BUFFER_REC *buffer)
text_chunk_create(buffer);
rec = g_mem_chunk_alloc(line_chunk);
- rec->refcount = 1;
rec->text = buffer->cur_text->buffer + buffer->cur_text->pos;
buffer->cur_text->refcount++;
@@ -216,36 +215,6 @@ static LINE_REC *textbuffer_line_insert(TEXT_BUFFER_REC *buffer,
return line;
}
-void textbuffer_line_ref(LINE_REC *line)
-{
- g_return_if_fail(line != NULL);
-
- if (++line->refcount == 255)
- g_error("line reference counter wrapped - shouldn't happen");
-}
-
-void textbuffer_line_unref(TEXT_BUFFER_REC *buffer, LINE_REC *line)
-{
- g_return_if_fail(buffer != NULL);
- g_return_if_fail(line != NULL);
-
- if (--line->refcount == 0) {
- text_chunk_line_free(buffer, line);
- g_mem_chunk_free(line_chunk, line);
- }
-}
-
-void textbuffer_line_unref_list(TEXT_BUFFER_REC *buffer, GList *list)
-{
- g_return_if_fail(buffer != NULL);
-
- while (list != NULL) {
- if (list->data != NULL)
- textbuffer_line_unref(buffer, list->data);
- list = list->next;
- }
-}
-
LINE_REC *textbuffer_line_last(TEXT_BUFFER_REC *buffer)
{
LINE_REC *line;
@@ -372,10 +341,11 @@ void textbuffer_remove(TEXT_BUFFER_REC *buffer, LINE_REC *line)
line->prev = line->next = NULL;
buffer->lines_count--;
- textbuffer_line_unref(buffer, line);
+ text_chunk_line_free(buffer, line);
+ g_mem_chunk_free(line_chunk, line);
}
-/* Removes all lines from buffer, ignoring reference counters */
+/* Removes all lines from buffer */
void textbuffer_remove_all_lines(TEXT_BUFFER_REC *buffer)
{
GSList *tmp;
@@ -563,17 +533,14 @@ GList *textbuffer_find_text(TEXT_BUFFER_REC *buffer, LINE_REC *startline,
pre_line = pre_line->prev;
}
- for (; pre_line != line; pre_line = pre_line->next) {
- textbuffer_line_ref(pre_line);
+ for (; pre_line != line; pre_line = pre_line->next)
matches = g_list_append(matches, pre_line);
- }
match_after = after;
}
if (line_matched || match_after > 0) {
/* matched */
- textbuffer_line_ref(line);
matches = g_list_append(matches, line);
if ((!line_matched && --match_after == 0) ||