Fix previous conflict.
[bpt/emacs.git] / src / intervals.c
index 639abcf..86cbe1e 100644 (file)
@@ -1,13 +1,13 @@
 /* Code for doing intervals.
    Copyright (C) 1993, 1994, 1995, 1997, 1998, 2001, 2002, 2003, 2004,
-                 2005, 2006, 2007  Free Software Foundation, Inc.
+                 2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
-GNU Emacs is free software; you can redistribute it and/or modify
+GNU Emacs is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -15,9 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA.  */
+along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 /* NOTES:
@@ -41,6 +39,7 @@ Boston, MA 02110-1301, USA.  */
 
 
 #include <config.h>
+#include <setjmp.h>
 #include "lisp.h"
 #include "intervals.h"
 #include "buffer.h"
@@ -53,9 +52,9 @@ Boston, MA 02110-1301, USA.  */
 
 #define TMEM(sym, set) (CONSP (set) ? ! NILP (Fmemq (sym, set)) : ! NILP (set))
 
-Lisp_Object merge_properties_sticky ();
-static INTERVAL reproduce_tree P_ ((INTERVAL, INTERVAL));
-static INTERVAL reproduce_tree_obj P_ ((INTERVAL, Lisp_Object));
+Lisp_Object merge_properties_sticky (Lisp_Object pleft, Lisp_Object pright);
+static INTERVAL reproduce_tree (INTERVAL, INTERVAL);
+static INTERVAL reproduce_tree_obj (INTERVAL, Lisp_Object);
 \f
 /* Utility functions for intervals.  */
 
@@ -63,8 +62,7 @@ static INTERVAL reproduce_tree_obj P_ ((INTERVAL, Lisp_Object));
 /* Create the root interval of some object, a buffer or string.  */
 
 INTERVAL
-create_root_interval (parent)
-     Lisp_Object parent;
+create_root_interval (Lisp_Object parent)
 {
   INTERVAL new;
 
@@ -96,8 +94,7 @@ create_root_interval (parent)
 /* Make the interval TARGET have exactly the properties of SOURCE */
 
 void
-copy_properties (source, target)
-     register INTERVAL source, target;
+copy_properties (register INTERVAL source, register INTERVAL target)
 {
   if (DEFAULT_INTERVAL_P (source) && DEFAULT_INTERVAL_P (target))
     return;
@@ -111,8 +108,7 @@ copy_properties (source, target)
    is added to TARGET if TARGET has no such property as yet.  */
 
 static void
-merge_properties (source, target)
-     register INTERVAL source, target;
+merge_properties (register INTERVAL source, register INTERVAL target)
 {
   register Lisp_Object o, sym, val;
 
@@ -150,8 +146,7 @@ merge_properties (source, target)
    0 otherwise.  */
 
 int
-intervals_equal (i0, i1)
-     INTERVAL i0, i1;
+intervals_equal (INTERVAL i0, INTERVAL i1)
 {
   register Lisp_Object i0_cdr, i0_sym;
   register Lisp_Object i1_cdr, i1_val;
@@ -207,10 +202,7 @@ intervals_equal (i0, i1)
    Pass FUNCTION two args: an interval, and ARG.  */
 
 void
-traverse_intervals_noorder (tree, function, arg)
-     INTERVAL tree;
-     void (* function) P_ ((INTERVAL, Lisp_Object));
-     Lisp_Object arg;
+traverse_intervals_noorder (INTERVAL tree, void (*function) (INTERVAL, Lisp_Object), Lisp_Object arg)
 {
   /* Minimize stack usage.  */
   while (!NULL_INTERVAL_P (tree))
@@ -230,11 +222,7 @@ traverse_intervals_noorder (tree, function, arg)
    Pass FUNCTION two args: an interval, and ARG.  */
 
 void
-traverse_intervals (tree, position, function, arg)
-     INTERVAL tree;
-     int position;
-     void (* function) P_ ((INTERVAL, Lisp_Object));
-     Lisp_Object arg;
+traverse_intervals (INTERVAL tree, int position, void (*function) (INTERVAL, Lisp_Object), Lisp_Object arg)
 {
   while (!NULL_INTERVAL_P (tree))
     {
@@ -324,8 +312,7 @@ root_interval (interval)
 */
 
 static INLINE INTERVAL
-rotate_right (interval)
-     INTERVAL interval;
+rotate_right (INTERVAL interval)
 {
   INTERVAL i;
   INTERVAL B = interval->left;
@@ -372,8 +359,7 @@ rotate_right (interval)
 */
 
 static INLINE INTERVAL
-rotate_left (interval)
-     INTERVAL interval;
+rotate_left (INTERVAL interval)
 {
   INTERVAL i;
   INTERVAL B = interval->right;
@@ -414,8 +400,7 @@ rotate_left (interval)
    themselves are already balanced.  */
 
 static INTERVAL
-balance_an_interval (i)
-     INTERVAL i;
+balance_an_interval (INTERVAL i)
 {
   register int old_diff, new_diff;
 
@@ -452,8 +437,7 @@ balance_an_interval (i)
    Lisp Object.  */
 
 static INLINE INTERVAL
-balance_possible_root_interval (interval)
-     register INTERVAL interval;
+balance_possible_root_interval (register INTERVAL interval)
 {
   Lisp_Object parent;
   int have_parent = 0;
@@ -483,8 +467,7 @@ balance_possible_root_interval (interval)
    (the amount of text).  */
 
 static INTERVAL
-balance_intervals_internal (tree)
-     register INTERVAL tree;
+balance_intervals_internal (register INTERVAL tree)
 {
   /* Balance within each side.  */
   if (tree->left)
@@ -497,8 +480,7 @@ balance_intervals_internal (tree)
 /* Advertised interface to balance intervals.  */
 
 INTERVAL
-balance_intervals (tree)
-     INTERVAL tree;
+balance_intervals (INTERVAL tree)
 {
   if (tree == NULL_INTERVAL)
     return NULL_INTERVAL;
@@ -520,9 +502,7 @@ balance_intervals (tree)
    it is still a root after this operation.  */
 
 INTERVAL
-split_interval_right (interval, offset)
-     INTERVAL interval;
-     int offset;
+split_interval_right (INTERVAL interval, int offset)
 {
   INTERVAL new = make_interval ();
   int position = interval->position;
@@ -567,9 +547,7 @@ split_interval_right (interval, offset)
    it is still a root after this operation.  */
 
 INTERVAL
-split_interval_left (interval, offset)
-     INTERVAL interval;
-     int offset;
+split_interval_left (INTERVAL interval, int offset)
 {
   INTERVAL new = make_interval ();
   int new_length = offset;
@@ -609,8 +587,7 @@ split_interval_left (interval, offset)
    of another interval!  */
 
 int
-interval_start_pos (source)
-     INTERVAL source;
+interval_start_pos (INTERVAL source)
 {
   Lisp_Object parent;
 
@@ -636,9 +613,7 @@ interval_start_pos (source)
    will update this cache based on the result of find_interval.  */
 
 INTERVAL
-find_interval (tree, position)
-     register INTERVAL tree;
-     register int position;
+find_interval (register INTERVAL tree, register int position)
 {
   /* The distance from the left edge of the subtree at TREE
                     to POSITION.  */
@@ -692,8 +667,7 @@ find_interval (tree, position)
    find_interval).  */
 
 INTERVAL
-next_interval (interval)
-     register INTERVAL interval;
+next_interval (register INTERVAL interval)
 {
   register INTERVAL i = interval;
   register int next_position;
@@ -732,8 +706,7 @@ next_interval (interval)
    find_interval).  */
 
 INTERVAL
-previous_interval (interval)
-     register INTERVAL interval;
+previous_interval (register INTERVAL interval)
 {
   register INTERVAL i;
 
@@ -772,9 +745,7 @@ previous_interval (interval)
    To speed up the process, we assume that the ->position of
    I and all its parents is already uptodate.  */
 INTERVAL
-update_interval (i, pos)
-     register INTERVAL i;
-     int pos;
+update_interval (register INTERVAL i, int pos)
 {
   if (NULL_INTERVAL_P (i))
     return NULL_INTERVAL;
@@ -893,9 +864,7 @@ adjust_intervals_for_insertion (tree, position, length)
    this text, and make it have the merged properties of both ends.  */
 
 static INTERVAL
-adjust_intervals_for_insertion (tree, position, length)
-     INTERVAL tree;
-     int position, length;
+adjust_intervals_for_insertion (INTERVAL tree, int position, int length)
 {
   register INTERVAL i;
   register INTERVAL temp;
@@ -1120,8 +1089,7 @@ FR     8  9  A  B
 */
 
 Lisp_Object
-merge_properties_sticky (pleft, pright)
-     Lisp_Object pleft, pright;
+merge_properties_sticky (Lisp_Object pleft, Lisp_Object pright)
 {
   register Lisp_Object props, front, rear;
   Lisp_Object lfront, lrear, rfront, rrear;
@@ -1257,8 +1225,7 @@ merge_properties_sticky (pleft, pright)
    storing the resulting subtree into its parent.  */
 
 static INTERVAL
-delete_node (i)
-     register INTERVAL i;
+delete_node (register INTERVAL i)
 {
   register INTERVAL migrate, this;
   register int migrate_amt;
@@ -1291,8 +1258,7 @@ delete_node (i)
    for the length of I.  */
 
 void
-delete_interval (i)
-     register INTERVAL i;
+delete_interval (register INTERVAL i)
 {
   register INTERVAL parent;
   int amt = LENGTH (i);
@@ -1346,9 +1312,7 @@ delete_interval (i)
    deleting the appropriate amount of text.  */
 
 static int
-interval_deletion_adjustment (tree, from, amount)
-     register INTERVAL tree;
-     register int from, amount;
+interval_deletion_adjustment (register INTERVAL tree, register int from, register int amount)
 {
   register int relative_position = from;
 
@@ -1408,9 +1372,7 @@ interval_deletion_adjustment (tree, from, amount)
    buffer position, i.e. origin 1).  */
 
 static void
-adjust_intervals_for_deletion (buffer, start, length)
-     struct buffer *buffer;
-     int start, length;
+adjust_intervals_for_deletion (struct buffer *buffer, int start, int length)
 {
   register int left_to_delete = length;
   register INTERVAL tree = BUF_INTERVALS (buffer);
@@ -1461,9 +1423,7 @@ adjust_intervals_for_deletion (buffer, start, length)
    of LENGTH.  */
 
 INLINE void
-offset_intervals (buffer, start, length)
-     struct buffer *buffer;
-     int start, length;
+offset_intervals (struct buffer *buffer, int start, int length)
 {
   if (NULL_INTERVAL_P (BUF_INTERVALS (buffer)) || length == 0)
     return;
@@ -1484,8 +1444,7 @@ offset_intervals (buffer, start, length)
    interval.  */
 
 INTERVAL
-merge_interval_right (i)
-     register INTERVAL i;
+merge_interval_right (register INTERVAL i)
 {
   register int absorb = LENGTH (i);
   register INTERVAL successor;
@@ -1541,8 +1500,7 @@ merge_interval_right (i)
    The caller must verify that this is not the first (leftmost) interval.  */
 
 INTERVAL
-merge_interval_left (i)
-     register INTERVAL i;
+merge_interval_left (register INTERVAL i)
 {
   register int absorb = LENGTH (i);
   register INTERVAL predecessor;
@@ -1596,12 +1554,11 @@ merge_interval_left (i)
    the pointers of the copy.  */
 
 static INTERVAL
-reproduce_tree (source, parent)
-     INTERVAL source, parent;
+reproduce_tree (INTERVAL source, INTERVAL parent)
 {
   register INTERVAL t = make_interval ();
 
-  bcopy (source, t, INTERVAL_SIZE);
+  memcpy (t, source, INTERVAL_SIZE);
   copy_properties (source, t);
   SET_INTERVAL_PARENT (t, parent);
   if (! NULL_LEFT_CHILD (source))
@@ -1613,13 +1570,11 @@ reproduce_tree (source, parent)
 }
 
 static INTERVAL
-reproduce_tree_obj (source, parent)
-     INTERVAL source;
-     Lisp_Object parent;
+reproduce_tree_obj (INTERVAL source, Lisp_Object parent)
 {
   register INTERVAL t = make_interval ();
 
-  bcopy (source, t, INTERVAL_SIZE);
+  memcpy (t, source, INTERVAL_SIZE);
   copy_properties (source, t);
   SET_INTERVAL_OBJECT (t, parent);
   if (! NULL_LEFT_CHILD (source))
@@ -1715,11 +1670,7 @@ make_new_interval (intervals, start, length)
    text...  */
 
 void
-graft_intervals_into_buffer (source, position, length, buffer, inherit)
-     INTERVAL source;
-     int position, length;
-     struct buffer *buffer;
-     int inherit;
+graft_intervals_into_buffer (INTERVAL source, int position, int length, struct buffer *buffer, int inherit)
 {
   register INTERVAL under, over, this, prev;
   register INTERVAL tree;
@@ -1877,18 +1828,13 @@ graft_intervals_into_buffer (source, position, length, buffer, inherit)
    and for PROP appearing on the default-text-properties list.  */
 
 Lisp_Object
-textget (plist, prop)
-     Lisp_Object plist;
-     register Lisp_Object prop;
+textget (Lisp_Object plist, register Lisp_Object prop)
 {
   return lookup_char_property (plist, prop, 1);
 }
 
 Lisp_Object
-lookup_char_property (plist, prop, textprop)
-     Lisp_Object plist;
-     register Lisp_Object prop;
-     int textprop;
+lookup_char_property (Lisp_Object plist, register Lisp_Object prop, int textprop)
 {
   register Lisp_Object tail, fallback = Qnil;
 
@@ -1926,9 +1872,7 @@ lookup_char_property (plist, prop, textprop)
 /* Set point "temporarily", without checking any text properties.  */
 
 INLINE void
-temp_set_point (buffer, charpos)
-     struct buffer *buffer;
-     int charpos;
+temp_set_point (struct buffer *buffer, EMACS_INT charpos)
 {
   temp_set_point_both (buffer, charpos,
                       buf_charpos_to_bytepos (buffer, charpos));
@@ -1938,9 +1882,8 @@ temp_set_point (buffer, charpos)
    byte position BYTEPOS.  */
 
 INLINE void
-temp_set_point_both (buffer, charpos, bytepos)
-     int charpos, bytepos;
-     struct buffer *buffer;
+temp_set_point_both (struct buffer *buffer,
+                    EMACS_INT charpos, EMACS_INT bytepos)
 {
   /* In a single-byte buffer, the two positions must be equal.  */
   if (BUF_ZV (buffer) == BUF_ZV_BYTE (buffer)
@@ -1961,11 +1904,9 @@ temp_set_point_both (buffer, charpos, bytepos)
    before an intangible character, move to an ok place.  */
 
 void
-set_point (buffer, charpos)
-     register struct buffer *buffer;
-     register int charpos;
+set_point (EMACS_INT charpos)
 {
-  set_point_both (buffer, charpos, buf_charpos_to_bytepos (buffer, charpos));
+  set_point_both (charpos, buf_charpos_to_bytepos (current_buffer, charpos));
 }
 
 /* If there's an invisible character at position POS + TEST_OFFS in the
@@ -1980,8 +1921,7 @@ set_point (buffer, charpos)
    if the invisible property comes from an overlay.  */
 
 static int
-adjust_for_invis_intang (pos, test_offs, adj, test_intang)
-     int pos, test_offs, adj, test_intang;
+adjust_for_invis_intang (int pos, int test_offs, int adj, int test_intang)
 {
   Lisp_Object invis_propval, invis_overlay;
   Lisp_Object test_pos;
@@ -2019,72 +1959,66 @@ adjust_for_invis_intang (pos, test_offs, adj, test_intang)
    before an intangible character, move to an ok place.  */
 
 void
-set_point_both (buffer, charpos, bytepos)
-     register struct buffer *buffer;
-     register int charpos, bytepos;
+set_point_both (EMACS_INT charpos, EMACS_INT bytepos)
 {
   register INTERVAL to, from, toprev, fromprev;
-  int buffer_point;
-  int old_position = BUF_PT (buffer);
+  EMACS_INT buffer_point;
+  EMACS_INT old_position = PT;
   /* This ensures that we move forward past intangible text when the
      initial position is the same as the destination, in the rare
      instances where this is important, e.g. in line-move-finish
      (simple.el).  */
   int backwards = (charpos < old_position ? 1 : 0);
   int have_overlays;
-  int original_position;
+  EMACS_INT original_position;
 
-  buffer->point_before_scroll = Qnil;
+  current_buffer->point_before_scroll = Qnil;
 
-  if (charpos == BUF_PT (buffer))
+  if (charpos == PT)
     return;
 
   /* In a single-byte buffer, the two positions must be equal.  */
-  if (BUF_ZV (buffer) == BUF_ZV_BYTE (buffer)
-      && charpos != bytepos)
-    abort ();
+  eassert (ZV != ZV_BYTE || charpos == bytepos);
 
   /* Check this now, before checking if the buffer has any intervals.
      That way, we can catch conditions which break this sanity check
      whether or not there are intervals in the buffer.  */
-  if (charpos > BUF_ZV (buffer) || charpos < BUF_BEGV (buffer))
-    abort ();
+  eassert (charpos <= ZV && charpos >= BEGV);
 
-  have_overlays = (buffer->overlays_before || buffer->overlays_after);
+  have_overlays = (current_buffer->overlays_before
+                  || current_buffer->overlays_after);
 
   /* If we have no text properties and overlays,
      then we can do it quickly.  */
-  if (NULL_INTERVAL_P (BUF_INTERVALS (buffer)) && ! have_overlays)
+  if (NULL_INTERVAL_P (BUF_INTERVALS (current_buffer)) && ! have_overlays)
     {
-      temp_set_point_both (buffer, charpos, bytepos);
+      temp_set_point_both (current_buffer, charpos, bytepos);
       return;
     }
 
   /* Set TO to the interval containing the char after CHARPOS,
      and TOPREV to the interval containing the char before CHARPOS.
      Either one may be null.  They may be equal.  */
-  to = find_interval (BUF_INTERVALS (buffer), charpos);
-  if (charpos == BUF_BEGV (buffer))
+  to = find_interval (BUF_INTERVALS (current_buffer), charpos);
+  if (charpos == BEGV)
     toprev = 0;
   else if (to && to->position == charpos)
     toprev = previous_interval (to);
   else
     toprev = to;
 
-  buffer_point = (BUF_PT (buffer) == BUF_ZV (buffer)
-                 ? BUF_ZV (buffer) - 1
-                 : BUF_PT (buffer));
+  buffer_point = (PT == ZV ? ZV - 1 : PT);
 
   /* Set FROM to the interval containing the char after PT,
      and FROMPREV to the interval containing the char before PT.
      Either one may be null.  They may be equal.  */
   /* We could cache this and save time.  */
-  from = find_interval (BUF_INTERVALS (buffer), buffer_point);
-  if (buffer_point == BUF_BEGV (buffer))
+  from = find_interval (BUF_INTERVALS (current_buffer), buffer_point);
+  if (buffer_point == BEGV)
     fromprev = 0;
-  else if (from && from->position == BUF_PT (buffer))
+  else if (from && from->position == PT)
     fromprev = previous_interval (from);
-  else if (buffer_point != BUF_PT (buffer))
+  else if (buffer_point != PT)
     fromprev = from, from = 0;
   else
     fromprev = from;
@@ -2093,7 +2027,7 @@ set_point_both (buffer, charpos, bytepos)
   if (to == from && toprev == fromprev && INTERVAL_VISIBLE_P (to)
       && ! have_overlays)
     {
-      temp_set_point_both (buffer, charpos, bytepos);
+      temp_set_point_both (current_buffer, charpos, bytepos);
       return;
     }
 
@@ -2130,7 +2064,7 @@ set_point_both (buffer, charpos, bytepos)
 
          if (! NILP (intangible_propval))
            {
-             while (XINT (pos) > BUF_BEGV (buffer)
+             while (XINT (pos) > BEGV
                     && EQ (Fget_char_property (make_number (XINT (pos) - 1),
                                                Qintangible, Qnil),
                            intangible_propval))
@@ -2163,7 +2097,7 @@ set_point_both (buffer, charpos, bytepos)
 
          if (! NILP (intangible_propval))
            {
-             while (XINT (pos) < BUF_ZV (buffer)
+             while (XINT (pos) < ZV
                     && EQ (Fget_char_property (pos, Qintangible, Qnil),
                            intangible_propval))
                pos = Fnext_char_property_change (pos, Qnil);
@@ -2177,7 +2111,7 @@ set_point_both (buffer, charpos, bytepos)
            }
        }
 
-      bytepos = buf_charpos_to_bytepos (buffer, charpos);
+      bytepos = buf_charpos_to_bytepos (current_buffer, charpos);
     }
 
   if (charpos != original_position)
@@ -2185,8 +2119,8 @@ set_point_both (buffer, charpos, bytepos)
       /* Set TO to the interval containing the char after CHARPOS,
         and TOPREV to the interval containing the char before CHARPOS.
         Either one may be null.  They may be equal.  */
-      to = find_interval (BUF_INTERVALS (buffer), charpos);
-      if (charpos == BUF_BEGV (buffer))
+      to = find_interval (BUF_INTERVALS (current_buffer), charpos);
+      if (charpos == BEGV)
        toprev = 0;
       else if (to && to->position == charpos)
        toprev = previous_interval (to);
@@ -2198,7 +2132,7 @@ set_point_both (buffer, charpos, bytepos)
      and TOPREV is the interval before the stopping point.
      One or the other may be null.  */
 
-  temp_set_point_both (buffer, charpos, bytepos);
+  temp_set_point_both (current_buffer, charpos, bytepos);
 
   /* We run point-left and point-entered hooks here, if the
      two intervals are not equivalent.  These hooks take
@@ -2249,8 +2183,7 @@ set_point_both (buffer, charpos, bytepos)
    segment that reaches all the way to point.  */
 
 void
-move_if_not_intangible (position)
-     int position;
+move_if_not_intangible (int position)
 {
   Lisp_Object pos;
   Lisp_Object intangible_propval;
@@ -2313,11 +2246,7 @@ move_if_not_intangible (position)
    nil means the current buffer. */
 
 int
-get_property_and_range (pos, prop, val, start, end, object)
-     int pos;
-     Lisp_Object prop, *val;
-     int *start, *end;
-     Lisp_Object object;
+get_property_and_range (int pos, Lisp_Object prop, Lisp_Object *val, EMACS_INT *start, EMACS_INT *end, Lisp_Object object)
 {
   INTERVAL i, prev, next;
 
@@ -2360,10 +2289,7 @@ get_property_and_range (pos, prop, val, start, end, object)
    POSITION must be in the accessible part of BUFFER.  */
 
 Lisp_Object
-get_local_map (position, buffer, type)
-     register int position;
-     register struct buffer *buffer;
-     Lisp_Object type;
+get_local_map (register int position, register struct buffer *buffer, Lisp_Object type)
 {
   Lisp_Object prop, lispy_position, lispy_buffer;
   int old_begv, old_zv, old_begv_byte, old_zv_byte;
@@ -2416,9 +2342,7 @@ get_local_map (position, buffer, type)
    The new interval tree has no parent and has a starting-position of 0.  */
 
 INTERVAL
-copy_intervals (tree, start, length)
-     INTERVAL tree;
-     int start, length;
+copy_intervals (INTERVAL tree, int start, int length)
 {
   register INTERVAL i, new, t;
   register int got, prevlen;
@@ -2459,10 +2383,7 @@ copy_intervals (tree, start, length)
 /* Give STRING the properties of BUFFER from POSITION to LENGTH.  */
 
 INLINE void
-copy_intervals_to_string (string, buffer, position, length)
-     Lisp_Object string;
-     struct buffer *buffer;
-     int position, length;
+copy_intervals_to_string (Lisp_Object string, struct buffer *buffer, int position, int length)
 {
   INTERVAL interval_copy = copy_intervals (BUF_INTERVALS (buffer),
                                           position, length);
@@ -2477,8 +2398,7 @@ copy_intervals_to_string (string, buffer, position, length)
    Assume they have identical characters.  */
 
 int
-compare_string_intervals (s1, s2)
-     Lisp_Object s1, s2;
+compare_string_intervals (Lisp_Object s1, Lisp_Object s2)
 {
   INTERVAL i1, i2;
   int pos = 0;
@@ -2516,10 +2436,7 @@ compare_string_intervals (s1, s2)
    START_BYTE ... END_BYTE in bytes.  */
 
 static void
-set_intervals_multibyte_1 (i, multi_flag, start, start_byte, end, end_byte)
-     INTERVAL i;
-     int multi_flag;
-     int start, start_byte, end, end_byte;
+set_intervals_multibyte_1 (INTERVAL i, int multi_flag, int start, int start_byte, int end, int end_byte)
 {
   /* Fix the length of this interval.  */
   if (multi_flag)
@@ -2629,8 +2546,7 @@ set_intervals_multibyte_1 (i, multi_flag, start, start_byte, end, end_byte)
    or to fit them as non-multibyte (if MULTI_FLAG is 0).  */
 
 void
-set_intervals_multibyte (multi_flag)
-     int multi_flag;
+set_intervals_multibyte (int multi_flag)
 {
   if (BUF_INTERVALS (current_buffer))
     set_intervals_multibyte_1 (BUF_INTERVALS (current_buffer), multi_flag,