I did a search for PL_*()
functions that update a char*
or wchar_t*
and found the following that are not documented as needing PL_STRINGS_MARK
… can any of them generate a temporary copy? (If so, I’ll update the documentation and the C++ API)
PL_atom_mbchars(atom_t a, size_t *len, char **s, unsigned int flags)
PL_get_atom_chars(term_t t, char **a)
PL_get_atom_nchars(term_t t, size_t *len, char **a)
PL_get_string(term_t t, char **s, size_t *len) // DEPRECATED
PL_get_list_chars(term_t l, char **s, unsigned int flags)
PL_get_list_nchars(term_t l, size_t *len, char **s, unsigned int flags)
PL_get_file_name(term_t n, char **name, int flags)
PL_get_file_nameW(term_t n, wchar_t **name, int flags)
PL_cvt_i_string(term_t p, char **c)
PL_cvt_i_codes(term_t p, char **c)
And here are the functions that are documented as requiring PL_STRINGS_MARK
:
PL_get_chars(term_t t, char **s, unsigned int flags)
PL_get_nchars(term_t t, size_t *len, char **s, unsigned int flags)
PL_get_wchars(term_t l, size_t *length, pl_wchar_t **s, unsigned flags)
Note that the C++ API tries to avoid the need for PL_STRINGS_MARK
(which it abstracts as the RAII class PlStringBuffers
) by returning std::string
rather than char*
.