mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-21 12:03:55 -08:00
Add assertion to STRING_SET_CHARS
* src/lisp.h (STRING_SET_CHARS): Add an assertion and commentary to prevent incorrect usage. For details, see this discussion: http://lists.gnu.org/archive/html/emacs-devel/2017-04/msg00412.html.
This commit is contained in:
parent
1bf7ca623b
commit
f3b24e90dc
1 changed files with 4 additions and 0 deletions
|
|
@ -1369,6 +1369,10 @@ SBYTES (Lisp_Object string)
|
|||
INLINE void
|
||||
STRING_SET_CHARS (Lisp_Object string, ptrdiff_t newsize)
|
||||
{
|
||||
/* This function cannot change the size of data allocated for the
|
||||
string when it was created. */
|
||||
eassert ((STRING_MULTIBYTE (string) && newsize <= SBYTES (string))
|
||||
|| (!STRING_MULTIBYTE (string) && newsize == SCHARS (string)));
|
||||
XSTRING (string)->size = newsize;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue