Function: obarray-clear

obarray-clear is a function defined in lread.c.

Signature

(obarray-clear OBARRAY)

Documentation

Remove all symbols from OBARRAY.

Other relevant functions are documented in the symbol group.

View in manual

Probably introduced at or before Emacs version 30.1.

Shortdoc

;; symbol
(obarray-clear my-obarray)

Source Code

// Defined in /usr/src/emacs/src/lread.c
{
  CHECK_OBARRAY (obarray);
  struct Lisp_Obarray *o = XOBARRAY (obarray);

  /* This function does not bother setting the status of its contained symbols
     to uninterned.  It doesn't matter very much.  */
  int new_bits = obarray_default_bits;
  int new_size = (ptrdiff_t)1 << new_bits;
  Lisp_Object *new_buckets
    = hash_table_alloc_bytes (new_size * sizeof *new_buckets);
  for (ptrdiff_t i = 0; i < new_size; i++)
    new_buckets[i] = make_fixnum (0);

  int old_size = obarray_size (o);
  hash_table_free_bytes (o->buckets, old_size * sizeof *o->buckets);
  o->buckets = new_buckets;
  o->size_bits = new_bits;
  o->count = 0;

  return Qnil;
}