From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Philipp Stephani
>=C2=A0 =C2=A0 =C2=A0Re this fragment from module.c:
>
>=C2=A0 =C2=A0 =C2=A0Lisp_Object ret =3D list4 (Qlambda,
>=C2=A0 =C2=A0 =C2=A0list2 (Qand_rest, Qargs),
>=C2=A0 =C2=A0 =C2=A0documentation ? build_string (documentation) : Qnil= ,
>=C2=A0 =C2=A0 =C2=A0list3 (module_call_func,
>=C2=A0 =C2=A0 =C2=A0envobj,
>=C2=A0 =C2=A0 =C2=A0Qargs));
>
>=C2=A0 =C2=A0 =C2=A0Thou shalt not use build_string, except when you _k= now_ the argument
>=C2=A0 =C2=A0 =C2=A0will always be a pure-ASCII string. Practically, th= is means the
>=C2=A0 =C2=A0 =C2=A0argument must be a constant ASCII string. See these= messages (and the
>=C2=A0 =C2=A0 =C2=A0preceding discussion, if you are interested) for th= e gory details:
>
>=C2=A0 =C2=A0 =C2=A0http://= lists.gnu.org/archive/html/bug-gnu-emacs/2013-10/msg00955.html
>=C2=A0 =C2=A0 =C2=A0http://= lists.gnu.org/archive/html/bug-gnu-emacs/2013-10/msg00976.html
>=C2=A0 =C2=A0 =C2=A0http://= lists.gnu.org/archive/html/bug-gnu-emacs/2013-10/msg00979.html
>
>=C2=A0 =C2=A0 =C2=A0The above should call make_multibyte_string instead= .
>
>
> We had a discussion about encodings in
> https://github.com/aaptel/emacs-dynamic= -module/issues/37. Sorry that this
> didn't get resolved earlier; it's an important point. My sugge= stion would be to
> always mandate specifying an encoding whenever a char* is passed, and = limit
> that to two or three functions dealing with creating strings and acces= sing
> string contents. Would that address your concerns?
No, this is not about encoding at all.=C2=A0 This is about calling
build_string: you should only call it when the argument is a fixed
ASCII string.=C2=A0 If the argument is not fixed or might include non-ASCII=
characters, you should call make_multibyte_string instead.=C2=A0 That's=
because build_string might decide on its own whether to produce a
unibyte or a multibyte string, out of your control, whereas we always
want a multibyte string in this context.
build_string doesn't encode or decode its argument, it creates a Lisp object whose text is taken from the argument.=C2=A0 It's similar to
make_number in that respect.