* editfns.c (region_limit): Simplify by using clip_to_bounds.
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 5 Jul 2012 16:00:20 +0000 (09:00 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 5 Jul 2012 16:00:20 +0000 (09:00 -0700)
src/ChangeLog
src/editfns.c

index 1cdd6c0..97c3ca9 100644 (file)
@@ -1,3 +1,7 @@
+2012-07-05  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * editfns.c (region_limit): Simplify by using clip_to_bounds.
+
 2012-07-05  Jan Djärv  <jan.h.d@swipnet.se>
 
        * gtkutil.c (gtk_scrollbar_new, gtk_box_new): Define when HAVE_GTK3 is
index 741a97f..5ca68d4 100644 (file)
@@ -281,13 +281,10 @@ region_limit (int beginningp)
   if (NILP (m))
     error ("The mark is not set now, so there is no region");
 
-  if ((PT < XFASTINT (m)) == (beginningp != 0))
-    return make_number (PT);
-  else
-    { /* Clip to the current narrowing (bug#11770).  */
-      ptrdiff_t mark = XFASTINT (m);
-      return make_number (mark < BEGV ? BEGV : mark > ZV ? ZV : mark);
-    }
+  /* Clip to the current narrowing (bug#11770).  */
+  return make_number ((PT < XFASTINT (m)) == (beginningp != 0)
+                     ? PT
+                     : clip_to_bounds (BEGV, XFASTINT (m), ZV));
 }
 
 DEFUN ("region-beginning", Fregion_beginning, Sregion_beginning, 0, 0, 0,