start_line->segments = seg;
}
else if (prev_seg->next &&
+ prev_seg->next != last_seg &&
seg->type == >k_text_toggle_off_type &&
prev_seg->next->type == >k_text_toggle_on_type &&
seg->body.toggle.info == prev_seg->next->body.toggle.info)
iter_stack_new (void)
{
IterStack *stack;
- stack = g_new (IterStack, 1);
+ stack = g_slice_new (IterStack);
stack->iters = NULL;
stack->count = 0;
stack->alloced = 0;
}
static void
-iter_stack_push (IterStack *stack, const GtkTextIter *iter)
+iter_stack_push (IterStack *stack,
+ const GtkTextIter *iter)
{
stack->count += 1;
if (stack->count > stack->alloced)
{
stack->alloced = stack->count*2;
stack->iters = g_realloc (stack->iters,
- stack->alloced*sizeof (GtkTextIter));
+ stack->alloced * sizeof (GtkTextIter));
}
stack->iters[stack->count-1] = *iter;
}
static gboolean
-iter_stack_pop (IterStack *stack, GtkTextIter *iter)
+iter_stack_pop (IterStack *stack,
+ GtkTextIter *iter)
{
if (stack->count == 0)
return FALSE;
iter_stack_free (IterStack *stack)
{
g_free (stack->iters);
- g_free (stack);
+ g_slice_free (IterStack, stack);
}
static void
GtkTextLineSegment *mark,
GtkTextIter *iter)
{
- if (gtk_text_iter_get_line (iter) ==
- _gtk_text_btree_line_count (tree))
+ if (gtk_text_iter_get_line (iter) == _gtk_text_btree_line_count (tree))
gtk_text_iter_backward_char (iter);
}
{
if (tree->end_iter_line_stamp != tree->chars_changed_stamp)
{
- int n_lines;
- int real_line;
-
- /* n_lines is without the magic line at the end */
- n_lines = _gtk_text_btree_line_count (tree);
-
- g_assert (n_lines >= 1);
+ gint real_line;
+
+ /* n_lines is without the magic line at the end */
+ g_assert (_gtk_text_btree_line_count (tree) >= 1);
tree->end_iter_line = _gtk_text_btree_get_line_no_last (tree, -1, &real_line);
while (offset >= seg->byte_count)
{
- g_assert (seg != NULL); /* means an invalid byte index */
offset -= seg->byte_count;
seg = seg->next;
+ g_assert (seg != NULL); /* means an invalid byte index */
}
if (seg_offset)
while (offset >= seg->char_count)
{
- g_assert (seg != NULL); /* means an invalid char index */
offset -= seg->char_count;
seg = seg->next;
+ g_assert (seg != NULL); /* means an invalid char index */
}
if (seg_offset)
while (offset > 0 && offset >= seg->byte_count)
{
- g_assert (seg != NULL); /* means an invalid byte index */
offset -= seg->byte_count;
seg = seg->next;
+ g_assert (seg != NULL); /* means an invalid byte index */
}
if (seg_offset)
while (offset > 0 && offset >= seg->char_count)
{
- g_assert (seg != NULL); /* means an invalid byte index */
offset -= seg->char_count;
seg = seg->next;
+ g_assert (seg != NULL); /* means an invalid byte index */
}
if (seg_offset)
while (byte_offset >= seg->byte_count) /* while (we need to go farther than
the next segment) */
{
- g_assert (seg != NULL); /* our byte_index was bogus if this happens */
-
byte_offset -= seg->byte_count;
char_offset += seg->char_count;
-
seg = seg->next;
+ g_assert (seg != NULL); /* our byte_index was bogus if this happens */
}
g_assert (seg != NULL);
static void
summary_list_destroy (Summary *summary)
{
- Summary *next;
- while (summary != NULL)
- {
- next = summary->next;
- summary_destroy (summary);
- summary = next;
- }
+ g_slice_free_chain (Summary, summary, next);
}
static GtkTextLine*
{
NodeData *nd;
- nd = g_new (NodeData, 1);
+ nd = g_slice_new (NodeData);
nd->view_id = view_id;
nd->next = NULL;
static void
node_data_destroy (NodeData *nd)
{
- g_free (nd);
+ g_slice_free (NodeData, nd);
}
static void
node_data_list_destroy (NodeData *nd)
{
- NodeData *iter;
- NodeData *next;
-
- iter = nd;
- while (iter != NULL)
- {
- next = iter->next;
- node_data_destroy (iter);
- iter = next;
- }
+ g_slice_free_chain (NodeData, nd, next);
}
static NodeData*
-node_data_find (NodeData *nd, gpointer view_id)
+node_data_find (NodeData *nd,
+ gpointer view_id)
{
while (nd != NULL)
{
summary->info = (void*)0x1;
summary->toggle_count = 567;
summary->next = (void*)0x1;
- g_free (summary);
+ g_slice_free (Summary, summary);
}
static GtkTextBTreeNode*
{
/* didn't find a summary for our tag. */
g_return_if_fail (adjust > 0);
- summary = g_new (Summary, 1);
+ summary = g_slice_new (Summary);
summary->info = info;
summary->toggle_count = adjust;
summary->next = node->summary;
{
/* didn't find it, create. */
- info = g_new (GtkTextTagInfo, 1);
+ info = g_slice_new (GtkTextTagInfo);
info->tag = tag;
g_object_ref (tag);
g_object_unref (info->tag);
- g_free (info);
+ g_slice_free (GtkTextTagInfo, info);
return;
}
*/
GtkTextBTreeNode *rootnode = info->tag_root;
- summary = (Summary *) g_malloc (sizeof (Summary));
+ summary = g_slice_new (Summary);
summary->info = info;
summary->toggle_count = info->toggle_count - delta;
summary->next = rootnode->summary;
rootLevel = rootnode->level;
info->tag_root = rootnode;
}
- summary = (Summary *) g_malloc (sizeof (Summary));
+ summary = g_slice_new (Summary);
summary->info = info;
summary->toggle_count = delta;
summary->next = node->summary;
}
else
{
- GtkTextLineSegmentClass * last = NULL;
+ const GtkTextLineSegmentClass *last = NULL;
for (line = node->children.line ; line != NULL ;
line = line->next)