diff options
Diffstat (limited to 'src/emacs-module.c')
| -rw-r--r-- | src/emacs-module.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/emacs-module.c b/src/emacs-module.c index 3581daad112..ba9de58de54 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c | |||
| @@ -791,6 +791,18 @@ module_make_string (emacs_env *env, const char *str, ptrdiff_t len) | |||
| 791 | } | 791 | } |
| 792 | 792 | ||
| 793 | static emacs_value | 793 | static emacs_value |
| 794 | module_make_unibyte_string (emacs_env *env, const char *str, ptrdiff_t length) | ||
| 795 | { | ||
| 796 | MODULE_FUNCTION_BEGIN (NULL); | ||
| 797 | if (! (0 <= length && length <= STRING_BYTES_BOUND)) | ||
| 798 | overflow_error (); | ||
| 799 | Lisp_Object lstr = make_uninit_string (length); | ||
| 800 | memcpy (SDATA (lstr), str, length); | ||
| 801 | SDATA (lstr)[length] = 0; | ||
| 802 | return lisp_to_value (env, lstr); | ||
| 803 | } | ||
| 804 | |||
| 805 | static emacs_value | ||
| 794 | module_make_user_ptr (emacs_env *env, emacs_finalizer fin, void *ptr) | 806 | module_make_user_ptr (emacs_env *env, emacs_finalizer fin, void *ptr) |
| 795 | { | 807 | { |
| 796 | MODULE_FUNCTION_BEGIN (NULL); | 808 | MODULE_FUNCTION_BEGIN (NULL); |
| @@ -1464,6 +1476,7 @@ initialize_environment (emacs_env *env, struct emacs_env_private *priv) | |||
| 1464 | env->make_float = module_make_float; | 1476 | env->make_float = module_make_float; |
| 1465 | env->copy_string_contents = module_copy_string_contents; | 1477 | env->copy_string_contents = module_copy_string_contents; |
| 1466 | env->make_string = module_make_string; | 1478 | env->make_string = module_make_string; |
| 1479 | env->make_unibyte_string = module_make_unibyte_string; | ||
| 1467 | env->make_user_ptr = module_make_user_ptr; | 1480 | env->make_user_ptr = module_make_user_ptr; |
| 1468 | env->get_user_ptr = module_get_user_ptr; | 1481 | env->get_user_ptr = module_get_user_ptr; |
| 1469 | env->set_user_ptr = module_set_user_ptr; | 1482 | env->set_user_ptr = module_set_user_ptr; |