all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* I don't understand this comment on message2
@ 2005-09-19  8:30 Kim F. Storm
  2005-09-20 19:43 ` Richard M. Stallman
  0 siblings, 1 reply; 3+ messages in thread
From: Kim F. Storm @ 2005-09-19  8:30 UTC (permalink / raw)



I have studied the code in message2 and the functions called by it
quite a lot (hunting for GC-related errors), and I don't understand
the restrictions in the second paragraph of message2's commentary
(included below).

It is indeed not safe to pass data from a lisp string (due to
potential GC), but not for the reasons listed.  I cannot find any
place where the buffer M is stored for later reference.
So using alloca'ed memory seems safe to me.

Can anyone enlighten me?



/* Display an echo area message M with a specified length of NBYTES
   bytes.  The string may include null characters.  If M is 0, clear
   out any existing message, and let the mini-buffer text show
   through.

   The buffer M must continue to exist until after the echo area gets
   cleared or some other message gets displayed there.  This means do
   not pass text that is stored in a Lisp string; do not pass text in
   a buffer that was alloca'd.  */

void
message2 (m, nbytes, multibyte)

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: I don't understand this comment on message2
  2005-09-19  8:30 I don't understand this comment on message2 Kim F. Storm
@ 2005-09-20 19:43 ` Richard M. Stallman
  2005-09-22 13:58   ` Kim F. Storm
  0 siblings, 1 reply; 3+ messages in thread
From: Richard M. Stallman @ 2005-09-20 19:43 UTC (permalink / raw)
  Cc: emacs-devel

       The buffer M must continue to exist until after the echo area gets
       cleared or some other message gets displayed there.  This means do
       not pass text that is stored in a Lisp string; do not pass text in
       a buffer that was alloca'd.  */

I think that comment is probably obsolete.  Nowadays the echo area
text is stored in real buffers.  Before Emacs 20, I think it was
stored in null-terminated C strings.

You could double-check this by looking at the code from Emacs 19.
If this comment was needed for that reason, it can be deleted now.

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

* Re: I don't understand this comment on message2
  2005-09-20 19:43 ` Richard M. Stallman
@ 2005-09-22 13:58   ` Kim F. Storm
  0 siblings, 0 replies; 3+ messages in thread
From: Kim F. Storm @ 2005-09-22 13:58 UTC (permalink / raw)
  Cc: emacs-devel

"Richard M. Stallman" <rms@gnu.org> writes:

>        The buffer M must continue to exist until after the echo area gets
>        cleared or some other message gets displayed there.  This means do
>        not pass text that is stored in a Lisp string; do not pass text in
>        a buffer that was alloca'd.  */
>
> I think that comment is probably obsolete.  Nowadays the echo area
> text is stored in real buffers.  Before Emacs 20, I think it was
> stored in null-terminated C strings.
>
> You could double-check this by looking at the code from Emacs 19.
> If this comment was needed for that reason, it can be deleted now.

That was the reason, yes.  I have rewritten the comment.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

end of thread, other threads:[~2005-09-22 13:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-19  8:30 I don't understand this comment on message2 Kim F. Storm
2005-09-20 19:43 ` Richard M. Stallman
2005-09-22 13:58   ` Kim F. Storm

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.