guile-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Enable utf8->string to take a range


From: Maxime Devos
Subject: Re: [PATCH] Enable utf8->string to take a range
Date: Fri, 21 Jan 2022 17:53:23 +0100
User-agent: Evolution 3.38.3-1

Vijay Marupudi schreef op do 20-01-2022 om 22:23 [-0500]:
> +      c_start = scm_to_size_t (start);
> +      if (SCM_UNLIKELY (c_start >= c_len))
> +        {
> +          scm_out_of_range (FUNC_NAME, start);
> +        }
> +
> +      if (!scm_is_eq (end, SCM_UNDEFINED))
> +     {
> +       c_end = scm_to_size_t (end);
> +       if (SCM_UNLIKELY (c_end > c_len))
> +         scm_out_of_range (FUNC_NAME, end);

IIUC, this will cause an out-of-range error for the following:

(utf8->string "" 0 0)

However, the following works:

(substring "" 0 0) ; -> empty string

There seems to be an inconsistency here.  Can (c_start >= c_len) be
relaxed to c_start > c_len?

Greetings,
Maxime.

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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