emacs-devel
[Top][All Lists]
Advanced

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

Re: Proposal: emulation-mode-map-alist


From: Stefan Monnier
Subject: Re: Proposal: emulation-mode-map-alist
Date: Thu, 08 Nov 2001 18:13:23 -0500

> read_key_sequence.  It is definitely desirable for read_key_sequence
> to be able to function without allocating memory, since many simple
> commands can execute without allocating any (in simple situations).

I was actually thinking of correctness rather than efficiency.
More specifically, I was referring to the following comment in
keymap.c (which I still haven't really understood, by the way):

   If we used xrealloc/xmalloc and ran out of memory, they would throw
   back to the command loop, which would try to read a key sequence,
   which would call this function again, resulting in an infinite
   loop.  Instead, we'll use realloc/malloc and silently truncate the
   list, let the key sequence be read, and hope some other piece of
   code signals the error.  */

The reason why I don't understand it is because read_key_sequence
seems to do memory allocation just fine (for example inside access_keymap
since it might run any elisp code), so it seems that it's only dangerous
in some portion of the function.
But then I'm wondering exactly during which part of read_key_sequence
is it dangerous to use xmalloc.


        Stefan




reply via email to

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