From: Paul Eggert Date: Thu, 5 Jul 2012 16:00:20 +0000 (-0700) Subject: * editfns.c (region_limit): Simplify by using clip_to_bounds. X-Git-Tag: emacs-24.2.90~1199^2~205 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f520ef9bc1f5d7b88b401c8784ac29457a0ef43c;p=emacs.git * editfns.c (region_limit): Simplify by using clip_to_bounds. --- diff --git a/src/ChangeLog b/src/ChangeLog index 1cdd6c07b47..97c3ca9547d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2012-07-05 Paul Eggert + + * editfns.c (region_limit): Simplify by using clip_to_bounds. + 2012-07-05 Jan Djärv * gtkutil.c (gtk_scrollbar_new, gtk_box_new): Define when HAVE_GTK3 is diff --git a/src/editfns.c b/src/editfns.c index 741a97f7113..5ca68d4f37a 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -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,