Commit 0c94c8d6 authored by Paul Eggert's avatar Paul Eggert

A few more naming-convention fixes for getters and setters.

* buffer.c (set_buffer_overlays_before): Move here from buffer.h,
and rename from buffer_overlays_set_before.
(set_buffer_overlays_after): Move here from buffer.h, and rename
from buffer_overlays_set_after.
* buffer.h (buffer_intervals): Rename from buffer_get_intervals.
All uses changed.
(set_buffer_intervals): Rename from buffer_set_intervals.
* intervals.c (set_interval_object): Move here from intervals.h,
and rename from interval_set_object.
(set_interval_left): Move here from intervals.h, and rename from
interval_set_left.
(set_interval_right): Move here from intervals.h, and rename from
interval_set_right.
(copy_interval_parent): Move here from intervals.h, and rename from
interval_copy_parent.
* intervals.h (set_interval_parent): Rename from interval_set_parent.
(set_interval_plist): Rename from interval_set_plist.
Return void, not Lisp_Object, since no caller uses the result.
* lisp.h (string_intervals): Rename from string_get_intervals.
(set_string_intervals): Rename from string_set_intervals.
parent ee218151
2012-08-17 Paul Eggert <eggert@cs.ucla.edu>
A few more naming-convention fixes for getters and setters.
* buffer.c (set_buffer_overlays_before): Move here from buffer.h,
and rename from buffer_overlays_set_before.
(set_buffer_overlays_after): Move here from buffer.h, and rename
from buffer_overlays_set_after.
* buffer.h (buffer_intervals): Rename from buffer_get_intervals.
All uses changed.
(set_buffer_intervals): Rename from buffer_set_intervals.
* intervals.c (set_interval_object): Move here from intervals.h,
and rename from interval_set_object.
(set_interval_left): Move here from intervals.h, and rename from
interval_set_left.
(set_interval_right): Move here from intervals.h, and rename from
interval_set_right.
(copy_interval_parent): Move here from intervals.h, and rename from
interval_copy_parent.
* intervals.h (set_interval_parent): Rename from interval_set_parent.
(set_interval_plist): Rename from interval_set_plist.
Return void, not Lisp_Object, since no caller uses the result.
* lisp.h (string_intervals): Rename from string_get_intervals.
(set_string_intervals): Rename from string_set_intervals.
* lisp.h (set_char_table_extras): Rename from char_table_set_extras.
(set_char_table_contents): Rename from char_table_set_contents.
(set_sub_char_table_contents): Rename from sub_char_table_set_contents.
......
......@@ -5836,7 +5836,7 @@ mark_buffer (struct buffer *buffer)
/* ...but there are some buffer-specific things. */
MARK_INTERVAL_TREE (buffer_get_intervals (buffer));
MARK_INTERVAL_TREE (buffer_intervals (buffer));
/* For now, we just don't mark the undo_list. It's done later in
a special way just before the sweep phase, and after stripping
......@@ -6090,7 +6090,7 @@ mark_object (Lisp_Object arg)
}
if (!PURE_POINTER_P (XSTRING (ptr->name)))
MARK_STRING (XSTRING (ptr->name));
MARK_INTERVAL_TREE (string_get_intervals (ptr->name));
MARK_INTERVAL_TREE (string_intervals (ptr->name));
ptr = ptr->next;
if (ptr)
......@@ -6405,7 +6405,7 @@ gc_sweep (void)
{
if (!iblk->intervals[i].gcmarkbit)
{
interval_set_parent (&iblk->intervals[i], interval_free_list);
set_interval_parent (&iblk->intervals[i], interval_free_list);
interval_free_list = &iblk->intervals[i];
this_free++;
}
......
......@@ -360,7 +360,7 @@ even if it is dead. The return value is never nil. */)
BUF_CHARS_MODIFF (b) = 1;
BUF_OVERLAY_MODIFF (b) = 1;
BUF_SAVE_MODIFF (b) = 1;
buffer_set_intervals (b, NULL);
set_buffer_intervals (b, NULL);
BUF_UNCHANGED_MODIFIED (b) = 1;
BUF_OVERLAY_UNCHANGED_MODIFIED (b) = 1;
BUF_END_UNCHANGED (b) = 0;
......@@ -384,7 +384,7 @@ even if it is dead. The return value is never nil. */)
BSET (b, zv_marker, Qnil);
name = Fcopy_sequence (buffer_or_name);
string_set_intervals (name, NULL);
set_string_intervals (name, NULL);
BSET (b, name, name);
BSET (b, undo_list, (SREF (name, 0) != ' ') ? Qnil : Qt);
......@@ -439,6 +439,19 @@ copy_overlays (struct buffer *b, struct Lisp_Overlay *list)
return result;
}
/* Set an appropriate overlay of B. */
static inline void
set_buffer_overlays_before (struct buffer *b, struct Lisp_Overlay *o)
{
b->overlays_before = o;
}
static inline void
set_buffer_overlays_after (struct buffer *b, struct Lisp_Overlay *o)
{
b->overlays_after = o;
}
/* Clone per-buffer values of buffer FROM.
......@@ -474,8 +487,8 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to)
memcpy (to->local_flags, from->local_flags, sizeof to->local_flags);
buffer_set_overlays_before (to, copy_overlays (to, from->overlays_before));
buffer_set_overlays_after (to, copy_overlays (to, from->overlays_after));
set_buffer_overlays_before (to, copy_overlays (to, from->overlays_before));
set_buffer_overlays_after (to, copy_overlays (to, from->overlays_after));
/* Get (a copy of) the alist of Lisp-level local variables of FROM
and install that in TO. */
......@@ -589,7 +602,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
all_buffers = b;
name = Fcopy_sequence (name);
string_set_intervals (name, NULL);
set_string_intervals (name, NULL);
BSET (b, name, name);
reset_buffer (b);
......@@ -688,8 +701,8 @@ delete_all_overlays (struct buffer *b)
ov->next = NULL;
}
buffer_set_overlays_before (b, NULL);
buffer_set_overlays_after (b, NULL);
set_buffer_overlays_before (b, NULL);
set_buffer_overlays_after (b, NULL);
}
/* Reinitialize everything about a buffer except its name and contents
......@@ -718,8 +731,8 @@ reset_buffer (register struct buffer *b)
b->auto_save_failure_time = 0;
BSET (b, auto_save_file_name, Qnil);
BSET (b, read_only, Qnil);
buffer_set_overlays_before (b, NULL);
buffer_set_overlays_after (b, NULL);
set_buffer_overlays_before (b, NULL);
set_buffer_overlays_after (b, NULL);
b->overlay_center = BEG;
BSET (b, mark_active, Qnil);
BSET (b, point_before_scroll, Qnil);
......@@ -1691,7 +1704,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
m = next;
}
BUF_MARKERS (b) = NULL;
buffer_set_intervals (b, NULL);
set_buffer_intervals (b, NULL);
/* Perhaps we should explicitly free the interval tree here... */
}
......@@ -3238,7 +3251,7 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos)
if (prev)
prev->next = next;
else
buffer_set_overlays_before (buf, next);
set_buffer_overlays_before (buf, next);
/* Search thru overlays_after for where to put it. */
other_prev = NULL;
......@@ -3260,7 +3273,7 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos)
if (other_prev)
other_prev->next = tail;
else
buffer_set_overlays_after (buf, tail);
set_buffer_overlays_after (buf, tail);
tail = prev;
}
else
......@@ -3296,7 +3309,7 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos)
if (prev)
prev->next = next;
else
buffer_set_overlays_after (buf, next);
set_buffer_overlays_after (buf, next);
/* Search thru overlays_before for where to put it. */
other_prev = NULL;
......@@ -3318,7 +3331,7 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos)
if (other_prev)
other_prev->next = tail;
else
buffer_set_overlays_before (buf, tail);
set_buffer_overlays_before (buf, tail);
tail = prev;
}
}
......@@ -3423,7 +3436,7 @@ fix_start_end_in_overlays (register ptrdiff_t start, register ptrdiff_t end)
beforep = tail;
}
if (!parent)
buffer_set_overlays_before (current_buffer, tail->next);
set_buffer_overlays_before (current_buffer, tail->next);
else
parent->next = tail->next;
tail = tail->next;
......@@ -3469,7 +3482,7 @@ fix_start_end_in_overlays (register ptrdiff_t start, register ptrdiff_t end)
beforep = tail;
}
if (!parent)
buffer_set_overlays_after (current_buffer, tail->next);
set_buffer_overlays_after (current_buffer, tail->next);
else
parent->next = tail->next;
tail = tail->next;
......@@ -3483,14 +3496,14 @@ fix_start_end_in_overlays (register ptrdiff_t start, register ptrdiff_t end)
if (beforep)
{
beforep->next = current_buffer->overlays_before;
buffer_set_overlays_before (current_buffer, before_list);
set_buffer_overlays_before (current_buffer, before_list);
}
recenter_overlay_lists (current_buffer, current_buffer->overlay_center);
if (afterp)
{
afterp->next = current_buffer->overlays_after;
buffer_set_overlays_after (current_buffer, after_list);
set_buffer_overlays_after (current_buffer, after_list);
}
recenter_overlay_lists (current_buffer, current_buffer->overlay_center);
}
......@@ -3567,7 +3580,7 @@ fix_overlays_before (struct buffer *bp, ptrdiff_t prev, ptrdiff_t pos)
if (!right_pair)
{
found->next = bp->overlays_before;
buffer_set_overlays_before (bp, found);
set_buffer_overlays_before (bp, found);
}
else
{
......@@ -3645,13 +3658,13 @@ for the rear of the overlay advance when text is inserted there
{
if (b->overlays_after)
XOVERLAY (overlay)->next = b->overlays_after;
buffer_set_overlays_after (b, XOVERLAY (overlay));
set_buffer_overlays_after (b, XOVERLAY (overlay));
}
else
{
if (b->overlays_before)
XOVERLAY (overlay)->next = b->overlays_before;
buffer_set_overlays_before (b, XOVERLAY (overlay));
set_buffer_overlays_before (b, XOVERLAY (overlay));
}
/* This puts it in the right list, and in the right order. */
......@@ -3716,8 +3729,8 @@ unchain_both (struct buffer *b, Lisp_Object overlay)
{
struct Lisp_Overlay *ov = XOVERLAY (overlay);
buffer_set_overlays_before (b, unchain_overlay (b->overlays_before, ov));
buffer_set_overlays_after (b, unchain_overlay (b->overlays_after, ov));
set_buffer_overlays_before (b, unchain_overlay (b->overlays_before, ov));
set_buffer_overlays_after (b, unchain_overlay (b->overlays_after, ov));
eassert (XOVERLAY (overlay)->next == NULL);
}
......@@ -3812,12 +3825,12 @@ buffer. */)
if (n_end < b->overlay_center)
{
XOVERLAY (overlay)->next = b->overlays_after;
buffer_set_overlays_after (b, XOVERLAY (overlay));
set_buffer_overlays_after (b, XOVERLAY (overlay));
}
else
{
XOVERLAY (overlay)->next = b->overlays_before;
buffer_set_overlays_before (b, XOVERLAY (overlay));
set_buffer_overlays_before (b, XOVERLAY (overlay));
}
/* This puts it in the right list, and in the right order. */
......@@ -4913,8 +4926,8 @@ init_buffer_once (void)
/* No one will share the text with these buffers, but let's play it safe. */
buffer_defaults.indirections = 0;
buffer_local_symbols.indirections = 0;
buffer_set_intervals (&buffer_defaults, NULL);
buffer_set_intervals (&buffer_local_symbols, NULL);
set_buffer_intervals (&buffer_defaults, NULL);
set_buffer_intervals (&buffer_local_symbols, NULL);
XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize);
XSETBUFFER (Vbuffer_defaults, &buffer_defaults);
XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize);
......@@ -4938,8 +4951,8 @@ init_buffer_once (void)
BSET (&buffer_defaults, mark_active, Qnil);
BSET (&buffer_defaults, file_format, Qnil);
BSET (&buffer_defaults, auto_save_file_format, Qt);
buffer_set_overlays_before (&buffer_defaults, NULL);
buffer_set_overlays_after (&buffer_defaults, NULL);
set_buffer_overlays_before (&buffer_defaults, NULL);
set_buffer_overlays_after (&buffer_defaults, NULL);
buffer_defaults.overlay_center = BEG;
XSETFASTINT (BVAR (&buffer_defaults, tab_width), 8);
......
......@@ -953,7 +953,7 @@ extern Lisp_Object Qfirst_change_hook;
/* Get text properties of B. */
BUFFER_INLINE INTERVAL
buffer_get_intervals (struct buffer *b)
buffer_intervals (struct buffer *b)
{
eassert (b->text != NULL);
return b->text->intervals;
......@@ -962,26 +962,12 @@ buffer_get_intervals (struct buffer *b)
/* Set text properties of B to I. */
BUFFER_INLINE void
buffer_set_intervals (struct buffer *b, INTERVAL i)
set_buffer_intervals (struct buffer *b, INTERVAL i)
{
eassert (b->text != NULL);
b->text->intervals = i;
}
/* Set an appropriate overlay of B. */
BUFFER_INLINE void
buffer_set_overlays_before (struct buffer *b, struct Lisp_Overlay *o)
{
b->overlays_before = o;
}
BUFFER_INLINE void
buffer_set_overlays_after (struct buffer *b, struct Lisp_Overlay *o)
{
b->overlays_after = o;
}
/* Non-zero if current buffer has overlays. */
BUFFER_INLINE int
......
......@@ -3936,7 +3936,7 @@ usage: (format STRING &rest OBJECTS) */)
/* If this argument has text properties, record where
in the result string it appears. */
if (string_get_intervals (args[n]))
if (string_intervals (args[n]))
info[n].intervals = arg_intervals = 1;
continue;
......@@ -4280,7 +4280,7 @@ usage: (format STRING &rest OBJECTS) */)
arguments has text properties, set up text properties of the
result string. */
if (string_get_intervals (args[0]) || arg_intervals)
if (string_intervals (args[0]) || arg_intervals)
{
Lisp_Object len, new_len, props;
struct gcpro gcpro1;
......@@ -4530,7 +4530,7 @@ Transposing beyond buffer boundaries is an error. */)
Lisp_Object buf;
XSETBUFFER (buf, current_buffer);
cur_intv = buffer_get_intervals (current_buffer);
cur_intv = buffer_intervals (current_buffer);
validate_region (&startr1, &endr1);
validate_region (&startr2, &endr2);
......
......@@ -3146,7 +3146,7 @@ decide_coding_unwind (Lisp_Object unwind_data)
set_buffer_internal (XBUFFER (buffer));
adjust_markers_for_delete (BEG, BEG_BYTE, Z, Z_BYTE);
adjust_overlays_for_delete (BEG, Z - BEG);
buffer_set_intervals (current_buffer, NULL);
set_buffer_intervals (current_buffer, NULL);
TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
/* Now we are safe to change the buffer's multibyteness directly. */
......
......@@ -628,7 +628,7 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
ptrdiff_t thislen_byte = SBYTES (this);
memcpy (SDATA (val) + toindex_byte, SDATA (this), SBYTES (this));
if (string_get_intervals (this))
if (string_intervals (this))
{
textprops[num_textprops].argnum = argnum;
textprops[num_textprops].from = 0;
......@@ -640,7 +640,7 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
/* Copy a single-byte string to a multibyte string. */
else if (STRINGP (this) && STRINGP (val))
{
if (string_get_intervals (this))
if (string_intervals (this))
{
textprops[num_textprops].argnum = argnum;
textprops[num_textprops].from = 0;
......@@ -1060,7 +1060,7 @@ If you're not sure, whether to use `string-as-multibyte' or
str_as_multibyte (SDATA (new_string), nbytes,
SBYTES (string), NULL);
string = new_string;
string_set_intervals (string, NULL);
set_string_intervals (string, NULL);
}
return string;
}
......
......@@ -336,7 +336,7 @@ current_column (void)
/* If the buffer has overlays, text properties,
or multibyte characters, use a more general algorithm. */
if (buffer_get_intervals (current_buffer)
if (buffer_intervals (current_buffer)
|| buffer_has_overlays ()
|| Z != Z_BYTE)
return current_column_1 ();
......
......@@ -844,10 +844,10 @@ insert_1_both (const char *string,
PT + nchars, PT_BYTE + nbytes,
before_markers);
if (buffer_get_intervals (current_buffer))
if (buffer_intervals (current_buffer))
offset_intervals (current_buffer, PT, nchars);
if (!inherit && buffer_get_intervals (current_buffer))
if (!inherit && buffer_intervals (current_buffer))
set_text_properties (make_number (PT), make_number (PT + nchars),
Qnil, Qnil, Qnil);
......@@ -976,7 +976,7 @@ insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
offset_intervals (current_buffer, PT, nchars);
intervals = string_get_intervals (string);
intervals = string_intervals (string);
/* Get the intervals for the part of the string we are inserting. */
if (nbytes < SBYTES (string))
intervals = copy_intervals (intervals, pos, nchars);
......@@ -1017,7 +1017,7 @@ insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes)
adjust_markers_for_insert (GPT - nchars, GPT_BYTE - nbytes,
GPT, GPT_BYTE, 0);
if (buffer_get_intervals (current_buffer))
if (buffer_intervals (current_buffer))
{
offset_intervals (current_buffer, GPT - nchars, nchars);
graft_intervals_into_buffer (NULL, GPT - nchars, nchars,
......@@ -1157,11 +1157,11 @@ insert_from_buffer_1 (struct buffer *buf,
PT_BYTE + outgoing_nbytes,
0);
if (buffer_get_intervals (current_buffer))
if (buffer_intervals (current_buffer))
offset_intervals (current_buffer, PT, nchars);
/* Get the intervals for the part of the string we are inserting. */
intervals = buffer_get_intervals (buf);
intervals = buffer_intervals (buf);
if (nchars < BUF_Z (buf) - BUF_BEG (buf))
{
if (buf == current_buffer && PT <= from)
......@@ -1226,7 +1226,7 @@ adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte,
else if (len < nchars_del)
adjust_overlays_for_delete (from, nchars_del - len);
if (buffer_get_intervals (current_buffer))
if (buffer_intervals (current_buffer))
offset_intervals (current_buffer, from, len - nchars_del);
if (from < PT)
......@@ -1412,7 +1412,7 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
/* Get the intervals for the part of the string we are inserting--
not including the combined-before bytes. */
intervals = string_get_intervals (new);
intervals = string_intervals (new);
/* Insert those intervals. */
graft_intervals_into_buffer (intervals, from, inschars,
current_buffer, inherit);
......@@ -1822,7 +1822,7 @@ prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end,
if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer)
++windows_or_buffers_changed;
if (buffer_get_intervals (current_buffer))
if (buffer_intervals (current_buffer))
{
if (preserve_ptr)
{
......
......@@ -62,6 +62,38 @@ static INTERVAL reproduce_tree (INTERVAL, INTERVAL);
/* Utility functions for intervals. */
/* Use these functions to set Lisp_Object
or pointer slots of struct interval. */
static inline void
set_interval_object (INTERVAL i, Lisp_Object obj)
{
eassert (BUFFERP (obj) || STRINGP (obj));
i->up_obj = 1;
i->up.obj = obj;
}
static inline void
set_interval_left (INTERVAL i, INTERVAL left)
{
i->left = left;
}
static inline void
set_interval_right (INTERVAL i, INTERVAL right)
{
i->right = right;
}
/* Make the parent of D be whatever the parent of S is, regardless
of the type. This is used when balancing an interval tree. */
static inline void
copy_interval_parent (INTERVAL d, INTERVAL s)
{
d->up = s->up;
d->up_obj = s->up_obj;
}
/* Create the root interval of some object, a buffer or string. */
......@@ -79,18 +111,18 @@ create_root_interval (Lisp_Object parent)
new->total_length = (BUF_Z (XBUFFER (parent))
- BUF_BEG (XBUFFER (parent)));
eassert (0 <= TOTAL_LENGTH (new));
buffer_set_intervals (XBUFFER (parent), new);
set_buffer_intervals (XBUFFER (parent), new);
new->position = BEG;
}
else if (STRINGP (parent))
{
new->total_length = SCHARS (parent);
eassert (0 <= TOTAL_LENGTH (new));
string_set_intervals (parent, new);
set_string_intervals (parent, new);
new->position = 0;
}
interval_set_object (new, parent);
set_interval_object (new, parent);
return new;
}
......@@ -104,7 +136,7 @@ copy_properties (register INTERVAL source, register INTERVAL target)
return;
COPY_INTERVAL_CACHE (source, target);
interval_set_plist (target, Fcopy_sequence (source->plist));
set_interval_plist (target, Fcopy_sequence (source->plist));
}
/* Merge the properties of interval SOURCE into the properties
......@@ -140,7 +172,7 @@ merge_properties (register INTERVAL source, register INTERVAL target)
if (NILP (val))
{
val = XCAR (o);
interval_set_plist (target, Fcons (sym, Fcons (val, target->plist)));
set_interval_plist (target, Fcons (sym, Fcons (val, target->plist)));
}
o = XCDR (o);
}
......@@ -322,21 +354,21 @@ rotate_right (INTERVAL interval)
if (! ROOT_INTERVAL_P (interval))
{
if (AM_LEFT_CHILD (interval))
interval_set_left (INTERVAL_PARENT (interval), B);
set_interval_left (INTERVAL_PARENT (interval), B);
else
interval_set_right (INTERVAL_PARENT (interval), B);
set_interval_right (INTERVAL_PARENT (interval), B);
}
interval_copy_parent (B, interval);
copy_interval_parent (B, interval);
/* Make B the parent of A */
i = B->right;
interval_set_right (B, interval);
interval_set_parent (interval, B);
set_interval_right (B, interval);
set_interval_parent (interval, B);
/* Make A point to c */
interval_set_left (interval, i);
set_interval_left (interval, i);
if (i)
interval_set_parent (i, interval);
set_interval_parent (i, interval);
/* A's total length is decreased by the length of B and its left child. */
interval->total_length -= B->total_length - LEFT_TOTAL_LENGTH (interval);
......@@ -369,21 +401,21 @@ rotate_left (INTERVAL interval)
if (! ROOT_INTERVAL_P (interval))
{
if (AM_LEFT_CHILD (interval))
interval_set_left (INTERVAL_PARENT (interval), B);
set_interval_left (INTERVAL_PARENT (interval), B);
else
interval_set_right (INTERVAL_PARENT (interval), B);
set_interval_right (INTERVAL_PARENT (interval), B);
}
interval_copy_parent (B, interval);
copy_interval_parent (B, interval);
/* Make B the parent of A */
i = B->left;
interval_set_left (B, interval);
interval_set_parent (interval, B);
set_interval_left (B, interval);
set_interval_parent (interval, B);
/* Make A point to c */
interval_set_right (interval, i);
set_interval_right (interval, i);
if (i)
interval_set_parent (i, interval);
set_interval_parent (i, interval);
/* A's total length is decreased by the length of B and its right child. */
interval->total_length -= B->total_length - RIGHT_TOTAL_LENGTH (interval);
......@@ -455,9 +487,9 @@ balance_possible_root_interval (register INTERVAL interval)
if (have_parent)
{
if (BUFFERP (parent))
buffer_set_intervals (XBUFFER (parent), interval);
set_buffer_intervals (XBUFFER (parent), interval);
else if (STRINGP (parent))
string_set_intervals (parent, interval);
set_string_intervals (parent, interval);
}
return interval;
......@@ -493,9 +525,9 @@ buffer_balance_intervals (struct buffer *b)
INTERVAL i;
eassert (b != NULL);
i = buffer_get_intervals (b);
i = buffer_intervals (b);
if (i)
buffer_set_intervals (b, balance_an_interval (i));
set_buffer_intervals (b, balance_an_interval (i));
}
/* Split INTERVAL into two pieces, starting the second piece at
......@@ -519,20 +551,20 @@ split_interval_right (INTERVAL interval, ptrdiff_t offset)
ptrdiff_t new_length = LENGTH (interval) - offset;
new->position = position + offset;
interval_set_parent (new, interval);
set_interval_parent (new, interval);
if (NULL_RIGHT_CHILD (interval))
{
interval_set_right (interval, new);
set_interval_right (interval, new);
new->total_length = new_length;
eassert (0 <= TOTAL_LENGTH (new));
}
else
{
/* Insert the new node between INTERVAL and its right child. */
interval_set_right (new, interval->right);
interval_set_parent (interval->right, new);
interval_set_right (interval, new);
set_interval_right (new, interval->right);
set_interval_parent (interval->right, new);
set_interval_right (interval, new);
new->total_length = new_length + new->right->total_length;
eassert (0 <= TOTAL_LENGTH (new));
balance_an_interval (new);
......@@ -564,20 +596,20 @@ split_interval_left (INTERVAL interval, ptrdiff_t offset)
new->position = interval->position;
interval->position = interval->position + offset;
interval_set_parent (new, interval);
set_interval_parent (new, interval);
if (NULL_LEFT_CHILD (interval))
{
interval_set_left (interval, new);
set_interval_left (interval, new);
new->total_length = new_length;
eassert (0 <= TOTAL_LENGTH (new));
}
else
{
/* Insert the new node between INTERVAL and its left child. */
interval_set_left (new, interval->left);
interval_set_parent (new->left, new);