]> git.eshelyaron.com Git - emacs.git/commitdiff
* marker.c (set_marker_restricted_both): Simplify by using
authorDmitry Antipov <dmantipov@yandex.ru>
Thu, 5 Jul 2012 16:14:39 +0000 (20:14 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Thu, 5 Jul 2012 16:14:39 +0000 (20:14 +0400)
clip_to_bounds.

src/ChangeLog
src/marker.c

index 97c3ca9547dcf0e2ba40efa2cf7a6abe9a39d91f..a2cfd3029f3755f4137b450815f14e86b762acd6 100644 (file)
@@ -1,3 +1,8 @@
+2012-07-05  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * marker.c (set_marker_restricted_both): Simplify by using
+       clip_to_bounds.
+
 2012-07-05  Paul Eggert  <eggert@cs.ucla.edu>
 
        * editfns.c (region_limit): Simplify by using clip_to_bounds.
index 2c09b8e19a22e20adc11b7845829a4ea63cf3519..a059987aa511ffbd19eac0402ed3b487492ce3a6 100644 (file)
@@ -667,14 +667,8 @@ set_marker_restricted_both (Lisp_Object marker, Lisp_Object buffer, ptrdiff_t ch
        }
     }
 
-  if (charpos < BUF_BEGV (b))
-    charpos = BUF_BEGV (b);
-  if (charpos > BUF_ZV (b))
-    charpos = BUF_ZV (b);
-  if (bytepos < BUF_BEGV_BYTE (b))
-    bytepos = BUF_BEGV_BYTE (b);
-  if (bytepos > BUF_ZV_BYTE (b))
-    bytepos = BUF_ZV_BYTE (b);
+  charpos = clip_to_bounds (BUF_BEGV (b), charpos, BUF_ZV (b));
+  bytepos = clip_to_bounds (BUF_BEGV_BYTE (b), bytepos, BUF_ZV_BYTE (b));
 
   /* In a single-byte buffer, the two positions must be equal.  */
   if (BUF_Z (b) == BUF_Z_BYTE (b)