emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Change to xdisp.c (forward_to_next_line_start)


From: Andrew Choi
Subject: Change to xdisp.c (forward_to_next_line_start)
Date: Thu, 18 Jan 2001 14:28:54 +0800

Hi,

Would yesterday's change (in forward_to_next_line_start in xdisp.c)
from

  /* Scan for a newline within MAX_NEWLINE_DISTANCE display elements
     from buffer text.  */
  n = newline_found_p = 0;
  while (n < MAX_NEWLINE_DISTANCE
         && get_next_display_element (it)
         && !newline_found_p)
    {
      newline_found_p = it->what == IT_CHARACTER && it->c == '\n';
      set_iterator_to_next (it, 0);
      if (!STRINGP (it->string))
        ++n;
    }
  ...

to

  /* Scan for a newline within MAX_NEWLINE_DISTANCE display elements
     from buffer text.  */
  for (n = newline_found_p = 0;
       !newline_found_p && n < MAX_NEWLINE_DISTANCE;
       n += STRINGP (it->string) ? 0 : 1)
    {
      get_next_display_element (it);
      newline_found_p = it->what == IT_CHARACTER && it->c == '\n';
      set_iterator_to_next (it, 0);
    }
  ...

cause a problem since by omitting the test of the return value of
get_next_display_element in the termination condition, the loop looks
beyond the end of the buffer!  This causes a crash on the Mac build
subsequently.

Andrew.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]