diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2020-10-13 06:51:06 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2020-10-13 06:51:06 +0200 |
commit | 12175a339e2a2214fdd0ab4e16d8d8b1e92a78d3 (patch) | |
tree | c68e82a585d8a760b569b536d8951e18166a9d9d /test/data | |
parent | 45cb0403deeba1cc121147b1884e7fea6cd15338 (diff) | |
download | emacs-12175a339e2a2214fdd0ab4e16d8d8b1e92a78d3.tar.gz |
Allow creating unibyte strings from Emacs modules
* doc/lispref/internals.texi (Module Values): Document
make_unibyte_string (bug#34873).
* src/emacs-module.c (module_make_unibyte_string): New function.
(initialize_environment): Export it.
* src/module-env-25.h: Define it.
* test/data/emacs-module/mod-test.c (Fmod_test_return_unibyte):
Test it.
* test/src/emacs-module-tests.el (module/unibyte): Test it.
Diffstat (limited to 'test/data')
-rw-r--r-- | test/data/emacs-module/mod-test.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/data/emacs-module/mod-test.c b/test/data/emacs-module/mod-test.c index da298d4e398..258a679b207 100644 --- a/test/data/emacs-module/mod-test.c +++ b/test/data/emacs-module/mod-test.c @@ -268,6 +268,16 @@ Fmod_test_string_a_to_b (emacs_env *env, ptrdiff_t nargs, emacs_value args[], } +/* Return a unibyte string. */ +static emacs_value +Fmod_test_return_unibyte (emacs_env *env, ptrdiff_t nargs, emacs_value args[], + void *data) +{ + const char *string = "foo\x00zot"; + return env->make_unibyte_string (env, string, 7); +} + + /* Embedded pointers in lisp objects. */ /* C struct (pointer to) that will be embedded. */ @@ -750,6 +760,7 @@ emacs_module_init (struct emacs_runtime *ert) DEFUN ("mod-test-globref-reordered", Fmod_test_globref_reordered, 0, 0, NULL, NULL); DEFUN ("mod-test-string-a-to-b", Fmod_test_string_a_to_b, 1, 1, NULL, NULL); + DEFUN ("mod-test-return-unibyte", Fmod_test_return_unibyte, 0, 0, NULL, NULL); DEFUN ("mod-test-userptr-make", Fmod_test_userptr_make, 1, 1, NULL, NULL); DEFUN ("mod-test-userptr-get", Fmod_test_userptr_get, 1, 1, NULL, NULL); DEFUN ("mod-test-vector-fill", Fmod_test_vector_fill, 2, 2, NULL, NULL); |