emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] * src/editfns.c (Fchar_after): Small optimization.


From: Eli Zaretskii
Subject: Re: [PATCH] * src/editfns.c (Fchar_after): Small optimization.
Date: Sat, 30 Sep 2017 22:05:51 +0300

> From: Philipp Stephani <address@hidden>
> Date: Sat, 30 Sep 2017 20:41:11 +0200
> Cc: Philipp Stephani <address@hidden>
> 
> ---
>  src/editfns.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/editfns.c b/src/editfns.c
> index b03eb947de..e87c682f97 100644
> --- a/src/editfns.c
> +++ b/src/editfns.c
> @@ -1256,10 +1256,10 @@ If POS is out of range, the value is nil.  */)
>    if (NILP (pos))
>      {
>        pos_byte = PT_BYTE;
> -      XSETFASTINT (pos, PT);
> +      if (pos_byte == ZV_BYTE)  <<<<<<<<<<<<<<<<<<<<<<
> +        return Qnil;

The comparison should use >=, not just ==, because PT could be
temporarily out of bounds.  I've seen Lisp hooks which cause such
calamities.  For the same reason, we should also check that PT_BYTE is
not smaller than BEGV_BYTE.

Thanks.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]