Exemplo n.º 1
0
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);
	}
}
Exemplo n.º 2
0
void textbuffer_remove(TEXT_BUFFER_REC *buffer, LINE_REC *line)
{
	g_return_if_fail(buffer != NULL);
	g_return_if_fail(line != NULL);

	if (buffer->first_line == line)
		buffer->first_line = line->next;
	if (line->prev != NULL)
		line->prev->next = line->next;
	if (line->next != NULL)
		line->next->prev = line->prev;

	if (buffer->cur_line == line) {
		buffer->cur_line = line->prev;
	}

        line->prev = line->next = NULL;

	buffer->lines_count--;
        text_chunk_line_free(buffer, line);
	g_slice_free(LINE_REC, line);
}