From: Paul Eggert Date: Mon, 25 Nov 2013 17:30:09 +0000 (-0800) Subject: Fix minor problems found by static checking. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~699 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4aaf6b615b41478b085c03f33831e0d72d0571e8;p=emacs.git 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. --- diff --git a/src/ChangeLog b/src/ChangeLog index 123feaffae0..ba0af53484d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2013-11-25 Paul Eggert + + 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 * textprop.c (text_property_stickiness): Fix front-stickiness at BOB. diff --git a/src/lread.c b/src/lread.c index d8efae05471..3063cf248f5 100644 --- a/src/lread.c +++ b/src/lread.c @@ -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; diff --git a/src/textprop.c b/src/textprop.c index 6a750f1361f..5597a781a61 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -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