On 11/19/2015 03:08 PM, Philipp Stephani wrote:
> Returning NULL is fine. malloc also returns NULL on OOM, and module.c
> handles that.
I'm not so much worried about emacs-module.c. I'm worried about what
modules will do. If we tell programmers 'just call xmalloc' things will
be easy for them. If not, they'll be more likely to make mistakes.
Is there some way xmalloc (actually, memory_full) can detect that it was
invoked from a module rather than from ordinary Emacs code? If so, we
could have memory_full do something different than call xsignal, in that
case.
Modules cannot (legally) call xmalloc. They need to obtain memory using malloc or any other standard function. In general, modules cannot call any functions except those declared in emacs-module.h.