summaryrefslogtreecommitdiff
path: root/src/emacs-module.c
diff options
context:
space:
mode:
authorPhilipp Stephani <phst@google.com>2019-12-26 10:29:21 +0100
committerPhilipp Stephani <phst@google.com>2019-12-26 10:29:21 +0100
commit719ad593872b606d2ca6ca5a144e37251c378078 (patch)
treeec4c57ed490cc4a86f7c743aa71b4438a334f93a /src/emacs-module.c
parent639fb50ed4c622f99dfbde32fbdbca42ce36d385 (diff)
downloademacs-719ad593872b606d2ca6ca5a144e37251c378078.tar.gz
Promote function type aliases to the public module API.
Previously module authors had to define type aliases for module functions and finalizers themselves. This commit adds and documents aliases so that this is no longer necessary. * src/emacs-module.h.in: Add 'emacs_function' and 'emacs_finalizer' type aliases. * src/emacs-module.c: Remove old 'emacs_subr' and 'emacs_finalizer' type aliases. (struct Lisp_Module_Function, module_make_function): Switch from 'emacs_subr' to 'emacs_function'. * doc/lispref/internals.texi (Module Functions): Document and use 'emacs_function' type alias. (Module Values): Document 'emacs_finalizer' type alias. * etc/NEWS: Mention change.
Diffstat (limited to 'src/emacs-module.c')
-rw-r--r--src/emacs-module.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/emacs-module.c b/src/emacs-module.c
index ff1a05450ce..76229137d87 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -122,12 +122,6 @@ To add a new module function, proceed as follows:
/* Function prototype for the module init function. */
typedef int (*emacs_init_function) (struct emacs_runtime *);
-/* Function prototype for module user-pointer finalizers. These
- should not throw C++ exceptions, so emacs-module.h declares the
- corresponding interfaces with EMACS_NOEXCEPT. There is only C code
- in this module, though, so this constraint is not enforced here. */
-typedef void (*emacs_finalizer) (void *);
-
/* Memory management. */
@@ -466,10 +460,6 @@ module_non_local_exit_throw (emacs_env *env, emacs_value tag, emacs_value value)
value_to_lisp (value));
}
-/* Function prototype for the module Lisp functions. */
-typedef emacs_value (*emacs_subr) (emacs_env *, ptrdiff_t,
- emacs_value *, void *);
-
/* Module function. */
/* A function environment is an auxiliary structure returned by
@@ -486,7 +476,7 @@ struct Lisp_Module_Function
/* Fields ignored by GC. */
ptrdiff_t min_arity, max_arity;
- emacs_subr subr;
+ emacs_function subr;
void *data;
} GCALIGNED_STRUCT;
@@ -505,7 +495,7 @@ allocate_module_function (void)
static emacs_value
module_make_function (emacs_env *env, ptrdiff_t min_arity, ptrdiff_t max_arity,
- emacs_subr func, const char *docstring, void *data)
+ emacs_function func, const char *docstring, void *data)
{
MODULE_FUNCTION_BEGIN (NULL);