* buffer.c: overlays_at, overlays_in
@ 2002-08-14 20:30 Janek Bogucki
2002-08-15 19:54 ` Richard Stallman
0 siblings, 1 reply; 2+ messages in thread
From: Janek Bogucki @ 2002-08-14 20:30 UTC (permalink / raw)
Hi,
I noticed a discrepency between the functions overlays_at and overlays_in in
buffer.c rev 1.399.
Here the effect would be for overlays_in to not extend the vector if it was
zero length initially.
Fragment A: overlays_at
-----------------------
if (idx == len)
{
/* The supplied vector is full.
Either make it bigger, or don't store any more in it. */
if (extend)
{
/* Make it work with an initial len == 0. */
len *= 2;
if (len == 0)
len = 4;
*len_ptr = len;
vec = (Lisp_Object *) xrealloc (vec, len * sizeof (Lisp_Object));
*vec_ptr = vec;
}
else
inhibit_storing = 1;
}
Fragment B: overlays_in
-----------------------
if (idx == len)
{
/* The supplied vector is full.
Either make it bigger, or don't store any more in it. */
if (extend)
{
*len_ptr = len *= 2;
vec = (Lisp_Object *) xrealloc (vec, len * sizeof (Lisp_Object));
*vec_ptr = vec;
}
else
inhibit_storing = 1;
}
Then later in the final for block for each fuction we have a similar
situation.
Fragment C: overlays_at
-----------------------
if (extend)
{
*len_ptr = len *= 2;
if (len == 0)
len = *len_ptr = 4;
vec = (Lisp_Object *) xrealloc (vec, len * sizeof (Lisp_Object));
*vec_ptr = vec;
}
else
inhibit_storing = 1;
Fragment D: overlays_in
-----------------------
if (extend)
{
*len_ptr = len *= 2;
vec = (Lisp_Object *) xrealloc (vec, len * sizeof (Lisp_Object));
*vec_ptr = vec;
}
else
inhibit_storing = 1;
There is also a possibly unwanted stylistic variation between fragment A &
C. In fragment C *len_ptr is assigned to before and in the if statement. In
fragment A *len_ptr is assigned to once, after the if statement.
As someone might say: Happy Hacking!
-Janek Bogucki
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: buffer.c: overlays_at, overlays_in
2002-08-14 20:30 buffer.c: overlays_at, overlays_in Janek Bogucki
@ 2002-08-15 19:54 ` Richard Stallman
0 siblings, 0 replies; 2+ messages in thread
From: Richard Stallman @ 2002-08-15 19:54 UTC (permalink / raw)
Cc: bug-gnu-emacs
Thanks for reporting this. I will make them all like fragment A.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-08-15 19:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-14 20:30 buffer.c: overlays_at, overlays_in Janek Bogucki
2002-08-15 19:54 ` Richard Stallman
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.