handa@etl.go.jp (Kenichi Handa) (12/24/89)
Here is a patch to fix a bug of causing 'segmentation fault'
when you run emacs with '-nw -q existing_file_name'. Eric,
thank you so much for the information of this bug.
---
Ken'ichi HANDA
================================================================
*** src/dispnew.c.old Sun Dec 24 13:46:18 1989
--- src/dispnew.c Sun Dec 24 13:36:18 1989
***************
*** 1,4 ****
--- 1,6 ----
/* 89.11.24 modified for attribute of characters by K.Handa */
+ /* 89.12.24 modified by K.Handa
+ 'count_blanks' has two arguments char *str, *attr */
/* Newly written part of redisplay code.
Copyright (C) 1985, 1986, 1987, 1988 Free Software Foundation, Inc.
***************
*** 289,295 ****
--- 291,301 ----
body = p->body - 1;
for (i = p->length; i > 0 && body[i - 1] == ' '; i--);
+ /* patch by K.Handa 89.12.24 */
+ /* original line is
i -= count_blanks (p->body);
+ and new line is */
+ i -= count_blanks (p->body, p->attribute);
return max (i, 0);
}
***************
*** 950,956 ****
--- 956,966 ----
if (!olen)
{
nsp = (must_write_spaces || new->highlighted)
+ /* patch for attribute by K.Handa 89.12.24 */
+ /* original line is
? 0 : count_blanks (nbody);
+ and new line is */
+ ? 0 : count_blanks (nbody, nattr);
if (nlen > nsp)
{
topos (vpos, nsp);
***************
*** 966,978 ****
nbody[nlen] = 0;
/* Compute number of leading blanks in old and new contents. */
! /* patch for attribute by K.Handa 89.11.24 */
! attribute_p = oattr;
osp = count_blanks (obody);
! /* patch for attribute by K.Handa 89.11.24 */
! attribute_p = nattr;
if (!new->highlighted)
nsp = count_blanks (nbody);
else
nsp = 0;
--- 976,992 ----
nbody[nlen] = 0;
/* Compute number of leading blanks in old and new contents. */
! /* patch for attribute by K.Handa 89.11.24, 89.12.24 */
! /* original line is
osp = count_blanks (obody);
! and new line is */
! osp = count_blanks (obody, oattr);
if (!new->highlighted)
+ /* patch for attribute by K.Handa 89.11.24, 89.12.24 */
+ /* original line is
nsp = count_blanks (nbody);
+ and new line is */
+ nsp = count_blanks (nbody, nattr);
else
nsp = 0;
***************
*** 1138,1152 ****
}
}
count_blanks (str)
char *str;
{
register char *p = str;
! /* patch for attribute by K.Handa 89.11.24 */
/* original line is
while (*str++ == ' ');
and new line is */
! while (*str++ == ' ' && *attribute_p++ == 0);
return str - p - 1;
}
--- 1152,1172 ----
}
}
+ /* patch for attribute by K.Handa 89.12.24 */
+ /* original line is
count_blanks (str)
+ and new lines are */
+ count_blanks (str, attr)
+ char *attr;
+ /* end of patch */
char *str;
{
register char *p = str;
! /* patch for attribute by K.Handa 89.11.24, 89.12.24 */
/* original line is
while (*str++ == ' ');
and new line is */
! while (*str++ == ' ' && *attr++ == 0);
return str - p - 1;
}