Function: clear-string

clear-string is a function defined in fns.c.

Signature

(clear-string STRING)

Documentation

Clear the contents of STRING.

This makes STRING unibyte, clears its contents to null characters, and removes all text properties. This may change its length.

View in manual

Source Code

// Defined in /usr/src/emacs/src/fns.c
{
  CHECK_STRING (string);
  ptrdiff_t len = SBYTES (string);
  Fset_text_properties (make_fixnum (0), make_fixnum (SCHARS (string)),
			Qnil, string);
  if (len != 0 || STRING_MULTIBYTE (string))
    {
      memset (SDATA (string), 0, len);
      STRING_SET_CHARS (string, len);
      STRING_SET_UNIBYTE (string);
    }
  return Qnil;
}