]> git.eshelyaron.com Git - emacs.git/commitdiff
Simplify module_make_function
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 24 Nov 2015 03:00:03 +0000 (19:00 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 24 Nov 2015 03:01:51 +0000 (19:01 -0800)
* src/emacs-module.c (module_make_function):
Simplify by calling build_unibyte_string.

src/emacs-module.c

index 209f99baf0ff3b36764783886c442c98b334fcad..11aefc31359095a7a122f2fd7beb4ffff58837cb 100644 (file)
@@ -387,16 +387,11 @@ module_make_function (emacs_env *env, ptrdiff_t min_arity, ptrdiff_t max_arity,
   envptr->data = data;
 
   Lisp_Object envobj = make_save_ptr (envptr);
-  Lisp_Object doc;
-  if (documentation == NULL)
-    doc = Qnil;
-  else
-    {
-      ptrdiff_t nbytes = strlen (documentation);
-      doc = make_unibyte_string (documentation, nbytes);
-      doc = code_convert_string_norecord (doc, Qutf_8, false);
-    }
-
+  Lisp_Object doc
+    = (documentation
+       ? code_convert_string_norecord (build_unibyte_string (documentation),
+                                      Qutf_8, false)
+       : Qnil);
   Lisp_Object ret = list4 (Qlambda,
                            list2 (Qand_rest, Qargs),
                            doc,