Fix minor problems found by static checking.

* lread.c (load_path_default): Now static.
* textprop.c (text_property_stickiness): Be consistent about the
test used when deciding whether to consider the previous character.
This simplifies the code a bit.
This commit is contained in:
Paul Eggert 2013-11-25 09:30:09 -08:00
parent f0ffd77d7c
commit 4aaf6b615b
3 changed files with 21 additions and 15 deletions

View file

@ -1,3 +1,11 @@
2013-11-25 Paul Eggert <eggert@cs.ucla.edu>
Fix minor problems found by static checking.
* lread.c (load_path_default): Now static.
* textprop.c (text_property_stickiness): Be consistent about the
test used when deciding whether to consider the previous character.
This simplifies the code a bit.
2013-11-25 Stefan Monnier <monnier@iro.umontreal.ca>
* textprop.c (text_property_stickiness): Fix front-stickiness at BOB.

View file

@ -4164,9 +4164,9 @@ static Lisp_Object dump_path;
out-of-tree build) AND install-dir/src/Makefile exists BUT
install-dir/src/Makefile.in does NOT exist (this is a sanity
check), then repeat the above steps for source-dir/lisp,
leim and site-lisp.
*/
Lisp_Object
leim and site-lisp. */
static Lisp_Object
load_path_default (bool changed)
{
Lisp_Object lpath = Qnil;

View file

@ -1819,23 +1819,23 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */
int
text_property_stickiness (Lisp_Object prop, Lisp_Object pos, Lisp_Object buffer)
{
Lisp_Object prev_pos, front_sticky;
bool ignore_previous_character;
Lisp_Object prev_pos = make_number (XINT (pos) - 1);
Lisp_Object front_sticky;
bool is_rear_sticky = true, is_front_sticky = false; /* defaults */
Lisp_Object defalt = Fassq (prop, Vtext_property_default_nonsticky);
if (NILP (buffer))
XSETBUFFER (buffer, current_buffer);
if (CONSP (defalt) && !NILP (XCDR (defalt)))
is_rear_sticky = 0;
ignore_previous_character = XINT (pos) <= BUF_BEGV (XBUFFER (buffer));
if (XINT (pos) > BUF_BEGV (XBUFFER (buffer)))
/* Consider previous character. */
if (ignore_previous_character || (CONSP (defalt) && !NILP (XCDR (defalt))))
is_rear_sticky = false;
else
{
Lisp_Object rear_non_sticky;
prev_pos = make_number (XINT (pos) - 1);
rear_non_sticky = Fget_text_property (prev_pos, Qrear_nonsticky, buffer);
Lisp_Object rear_non_sticky
= Fget_text_property (prev_pos, Qrear_nonsticky, buffer);
if (!NILP (CONSP (rear_non_sticky)
? Fmemq (prop, rear_non_sticky)
@ -1843,8 +1843,6 @@ text_property_stickiness (Lisp_Object prop, Lisp_Object pos, Lisp_Object buffer)
/* PROP is rear-non-sticky. */
is_rear_sticky = false;
}
else
is_rear_sticky = false;
/* Consider following character. */
/* This signals an arg-out-of-range error if pos is outside the
@ -1869,7 +1867,7 @@ text_property_stickiness (Lisp_Object prop, Lisp_Object pos, Lisp_Object buffer)
disambiguate. Basically, rear-sticky wins, _except_ if the
property that would be inherited has a value of nil, in which case
front-sticky wins. */
if (XINT (pos) == BUF_BEGV (XBUFFER (buffer))
if (ignore_previous_character
|| NILP (Fget_text_property (prev_pos, prop, buffer)))
return 1;
else