unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* region_limit fix
@ 2012-06-29  2:29 Dmitry Antipov
  2012-06-29 16:48 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Antipov @ 2012-06-29  2:29 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs development discussions

Introduced in 108793, found when compiling with --enable-check-lisp-object-type:

editfns.c: In function 'region_limit':
editfns.c:290:14: error: type mismatch in conditional expression

In:

   return make_number (mark < BEGV ? BEGV : mark > ZV ? ZV : m);

Lisp_Object 'm' is compared with ptrdiff_t.

Fixed in 108796.

Dmitry



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: region_limit fix
  2012-06-29  2:29 region_limit fix Dmitry Antipov
@ 2012-06-29 16:48 ` Stefan Monnier
  2012-06-29 17:47   ` Dmitry Antipov
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2012-06-29 16:48 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Emacs development discussions

>   return make_number (mark < BEGV ? BEGV : mark > ZV ? ZV : m);
                                                             ^^^
                                                             mark
> Lisp_Object 'm' is compared with ptrdiff_t.

Indeed, thank you for catching and fixing it.  I need to change my
config to use the new struct-lisp-type, obviously.


        Stefan



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: region_limit fix
  2012-06-29 16:48 ` Stefan Monnier
@ 2012-06-29 17:47   ` Dmitry Antipov
  2012-06-30  4:09     ` Stefan Monnier
  2012-07-05 16:01     ` Paul Eggert
  0 siblings, 2 replies; 5+ messages in thread
From: Dmitry Antipov @ 2012-06-29 17:47 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs development discussions

On 06/29/2012 08:48 PM, Stefan Monnier wrote:
>>    return make_number (mark < BEGV ? BEGV : mark > ZV ? ZV : m);
>                                                               ^^^
>                                                               mark
>> Lisp_Object 'm' is compared with ptrdiff_t.
>
> Indeed, thank you for catching and fixing it.  I need to change my
> config to use the new struct-lisp-type, obviously.

BTW, shouldn't we use clip_to_bounds here? E.g.:

--- src/editfns.c	2012-06-29 02:19:32 +0000
+++ src/editfns.c	2012-06-29 02:42:27 +0000
@@ -284,11 +284,8 @@

    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 (clip_to_bounds (BEGV, XFASTINT (m), ZV));
  }

Dmitry





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: region_limit fix
  2012-06-29 17:47   ` Dmitry Antipov
@ 2012-06-30  4:09     ` Stefan Monnier
  2012-07-05 16:01     ` Paul Eggert
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2012-06-30  4:09 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Emacs development discussions

> BTW, shouldn't we use clip_to_bounds here? E.g.:

We could, yes,


        Stefan



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: region_limit fix
  2012-06-29 17:47   ` Dmitry Antipov
  2012-06-30  4:09     ` Stefan Monnier
@ 2012-07-05 16:01     ` Paul Eggert
  1 sibling, 0 replies; 5+ messages in thread
From: Paul Eggert @ 2012-07-05 16:01 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Stefan Monnier, Emacs development discussions

On 06/29/2012 10:47 AM, Dmitry Antipov wrote:
> BTW, shouldn't we use clip_to_bounds here?

Yes, that simplifies things a bit, so I did that
as trunk bzr 108882.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-07-05 16:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-29  2:29 region_limit fix Dmitry Antipov
2012-06-29 16:48 ` Stefan Monnier
2012-06-29 17:47   ` Dmitry Antipov
2012-06-30  4:09     ` Stefan Monnier
2012-07-05 16:01     ` Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).