From f520ef9bc1f5d7b88b401c8784ac29457a0ef43c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 5 Jul 2012 09:00:20 -0700 Subject: [PATCH] * editfns.c (region_limit): Simplify by using clip_to_bounds. --- src/ChangeLog | 4 ++++ src/editfns.c | 11 ++++------- 2 files changed, 8 insertions(+), 7 deletions(-) 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, -- 2.39.2