mirror of
https://github.com/irssi/irssi.git
synced 2024-11-03 04:27:19 -05:00
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
This commit is contained in:
parent
875adf35a0
commit
aa39fba88d
@ -153,7 +153,6 @@ static void show_lastlog(const char *searchtext, GHashTable *optlist,
|
|||||||
if (g_hash_table_lookup(optlist, "count") != NULL) {
|
if (g_hash_table_lookup(optlist, "count") != NULL) {
|
||||||
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
|
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
|
||||||
TXT_LASTLOG_COUNT, len);
|
TXT_LASTLOG_COUNT, len);
|
||||||
textbuffer_line_unref_list(WINDOW_GUI(window)->view->buffer, list);
|
|
||||||
g_list_free(list);
|
g_list_free(list);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -163,7 +162,6 @@ static void show_lastlog(const char *searchtext, GHashTable *optlist,
|
|||||||
printformat_window(active_win,
|
printformat_window(active_win,
|
||||||
MSGLEVEL_CLIENTNOTICE|MSGLEVEL_LASTLOG,
|
MSGLEVEL_CLIENTNOTICE|MSGLEVEL_LASTLOG,
|
||||||
TXT_LASTLOG_TOO_LONG, len);
|
TXT_LASTLOG_TOO_LONG, len);
|
||||||
textbuffer_line_unref_list(WINDOW_GUI(window)->view->buffer, list);
|
|
||||||
g_list_free(list);
|
g_list_free(list);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -221,7 +219,6 @@ static void show_lastlog(const char *searchtext, GHashTable *optlist,
|
|||||||
textbuffer_view_set_bookmark_bottom(WINDOW_GUI(window)->view,
|
textbuffer_view_set_bookmark_bottom(WINDOW_GUI(window)->view,
|
||||||
"lastlog_last_check");
|
"lastlog_last_check");
|
||||||
|
|
||||||
textbuffer_line_unref_list(WINDOW_GUI(window)->view->buffer, list);
|
|
||||||
g_list_free(list);
|
g_list_free(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +183,6 @@ static LINE_REC *textbuffer_line_create(TEXT_BUFFER_REC *buffer)
|
|||||||
text_chunk_create(buffer);
|
text_chunk_create(buffer);
|
||||||
|
|
||||||
rec = g_mem_chunk_alloc(line_chunk);
|
rec = g_mem_chunk_alloc(line_chunk);
|
||||||
rec->refcount = 1;
|
|
||||||
rec->text = buffer->cur_text->buffer + buffer->cur_text->pos;
|
rec->text = buffer->cur_text->buffer + buffer->cur_text->pos;
|
||||||
|
|
||||||
buffer->cur_text->refcount++;
|
buffer->cur_text->refcount++;
|
||||||
@ -216,36 +215,6 @@ static LINE_REC *textbuffer_line_insert(TEXT_BUFFER_REC *buffer,
|
|||||||
return line;
|
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 *textbuffer_line_last(TEXT_BUFFER_REC *buffer)
|
||||||
{
|
{
|
||||||
LINE_REC *line;
|
LINE_REC *line;
|
||||||
@ -372,10 +341,11 @@ void textbuffer_remove(TEXT_BUFFER_REC *buffer, LINE_REC *line)
|
|||||||
line->prev = line->next = NULL;
|
line->prev = line->next = NULL;
|
||||||
|
|
||||||
buffer->lines_count--;
|
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)
|
void textbuffer_remove_all_lines(TEXT_BUFFER_REC *buffer)
|
||||||
{
|
{
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
@ -563,17 +533,14 @@ GList *textbuffer_find_text(TEXT_BUFFER_REC *buffer, LINE_REC *startline,
|
|||||||
pre_line = pre_line->prev;
|
pre_line = pre_line->prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; pre_line != line; pre_line = pre_line->next) {
|
for (; pre_line != line; pre_line = pre_line->next)
|
||||||
textbuffer_line_ref(pre_line);
|
|
||||||
matches = g_list_append(matches, pre_line);
|
matches = g_list_append(matches, pre_line);
|
||||||
}
|
|
||||||
|
|
||||||
match_after = after;
|
match_after = after;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line_matched || match_after > 0) {
|
if (line_matched || match_after > 0) {
|
||||||
/* matched */
|
/* matched */
|
||||||
textbuffer_line_ref(line);
|
|
||||||
matches = g_list_append(matches, line);
|
matches = g_list_append(matches, line);
|
||||||
|
|
||||||
if ((!line_matched && --match_after == 0) ||
|
if ((!line_matched && --match_after == 0) ||
|
||||||
|
@ -48,7 +48,6 @@ typedef struct _LINE_REC {
|
|||||||
struct _LINE_REC *prev, *next;
|
struct _LINE_REC *prev, *next;
|
||||||
|
|
||||||
unsigned char *text;
|
unsigned char *text;
|
||||||
unsigned char refcount;
|
|
||||||
LINE_INFO_REC info;
|
LINE_INFO_REC info;
|
||||||
} LINE_REC;
|
} LINE_REC;
|
||||||
|
|
||||||
@ -77,10 +76,6 @@ TEXT_BUFFER_REC *textbuffer_create(void);
|
|||||||
/* Destroy the buffer */
|
/* Destroy the buffer */
|
||||||
void textbuffer_destroy(TEXT_BUFFER_REC *buffer);
|
void textbuffer_destroy(TEXT_BUFFER_REC *buffer);
|
||||||
|
|
||||||
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);
|
LINE_REC *textbuffer_line_last(TEXT_BUFFER_REC *buffer);
|
||||||
int textbuffer_line_exists_after(LINE_REC *line, LINE_REC *search);
|
int textbuffer_line_exists_after(LINE_REC *line, LINE_REC *search);
|
||||||
|
|
||||||
|
@ -58,17 +58,6 @@ CODE:
|
|||||||
OUTPUT:
|
OUTPUT:
|
||||||
RETVAL
|
RETVAL
|
||||||
|
|
||||||
void
|
|
||||||
textbuffer_line_ref(line)
|
|
||||||
Irssi::TextUI::Line line
|
|
||||||
|
|
||||||
void
|
|
||||||
textbuffer_line_unref(line, buffer)
|
|
||||||
Irssi::TextUI::Line line
|
|
||||||
Irssi::TextUI::TextBuffer buffer
|
|
||||||
CODE:
|
|
||||||
textbuffer_line_unref(buffer, line);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
textbuffer_line_get_text(line, coloring)
|
textbuffer_line_get_text(line, coloring)
|
||||||
Irssi::TextUI::Line line
|
Irssi::TextUI::Line line
|
||||||
|
Loading…
Reference in New Issue
Block a user