Exemplo n.º 1
0
/* Allocate a tbitset element.  The bits are not cleared.  */
static inline tbitset_elt *
tbitset_elt_alloc (void)
{
  tbitset_elt *elt;

  if (tbitset_free_list != 0)
    {
      elt = tbitset_free_list;
      tbitset_free_list = EBITSET_NEXT (elt);
    }
  else
    {
      if (!tbitset_obstack_init)
        {
          tbitset_obstack_init = true;

          /* Let particular systems override the size of a chunk.  */

#ifndef OBSTACK_CHUNK_SIZE
#define OBSTACK_CHUNK_SIZE 0
#endif

          /* Let them override the alloc and free routines too.  */

#ifndef OBSTACK_CHUNK_ALLOC
#define OBSTACK_CHUNK_ALLOC xmalloc
#endif

#ifndef OBSTACK_CHUNK_FREE
#define OBSTACK_CHUNK_FREE free
#endif

#if ! defined __GNUC__ || __GNUC__ < 2
#define __alignof__(type) 0
#endif

          obstack_specify_allocation (&tbitset_obstack, OBSTACK_CHUNK_SIZE,
                                      __alignof__ (tbitset_elt),
                                      OBSTACK_CHUNK_ALLOC,
                                      OBSTACK_CHUNK_FREE);
        }

      /* Perhaps we should add a number of new elements to the free
         list.  */
      elt = (tbitset_elt *) obstack_alloc (&tbitset_obstack,
                                           sizeof (tbitset_elt));
    }

  return elt;
}
Exemplo n.º 2
0
static inline void
tbitset_elt_free (tbitset_elt *elt)
{
  EBITSET_NEXT (elt) = tbitset_free_list;
  tbitset_free_list = elt;
}
Exemplo n.º 3
0
static inline void
ebitset_elt_free (ebitset_elt *elt)
{
  EBITSET_NEXT (elt) = ebitset_free_list;
  ebitset_free_list = elt;
}