emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r115232: Fix minor problems found by static checking


From: Paul Eggert
Subject: [Emacs-diffs] trunk r115232: Fix minor problems found by static checking.
Date: Mon, 25 Nov 2013 17:30:14 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115232
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Mon 2013-11-25 09:30:09 -0800
message:
  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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/lread.c                    lread.c-20091113204419-o5vbwnq5f7feedwu-266
  src/textprop.c                 textprop.c-20091113204419-o5vbwnq5f7feedwu-512
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-11-25 15:42:06 +0000
+++ b/src/ChangeLog     2013-11-25 17:30:09 +0000
@@ -1,3 +1,11 @@
+2013-11-25  Paul Eggert  <address@hidden>
+
+       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  <address@hidden>
 
        * textprop.c (text_property_stickiness): Fix front-stickiness at BOB.

=== modified file 'src/lread.c'
--- a/src/lread.c       2013-11-25 03:10:54 +0000
+++ b/src/lread.c       2013-11-25 17:30:09 +0000
@@ -4164,9 +4164,9 @@
    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;

=== modified file 'src/textprop.c'
--- a/src/textprop.c    2013-11-25 15:42:06 +0000
+++ b/src/textprop.c    2013-11-25 17:30:09 +0000
@@ -1819,23 +1819,23 @@
 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 @@
        /* 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 @@
      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


reply via email to

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