Ejemplo n.º 1
0
static void hklr_gc_release(HklrObject* object)
{
  switch (object->type)
  {
    // If the object is a hash table
    case HKL_TYPE_HASH:
      // Traverse the hash decrementing every child
      hkl_hash_traverse(object->as.hash, hklr_gc_dec_hash, NULL);
      break;

    // If the object is a reference
    case HKL_TYPE_REF:
      hklr_gc_dec(object->as.object);
      break; 

    default: break;
  }

  object->color = HKL_COLOR_BLACK;

  if (!object->is_buffered)
  {
    HKLR.gc_freed++;
    hklr_object_free(object);
  }
}
Ejemplo n.º 2
0
static bool dec_closures(HklPair* pair, void* data)
{
  if (pair->value != NULL)
    hklr_gc_dec((HklrObject*) pair->value);

  return false;
}
Ejemplo n.º 3
0
static void hklr_gc_dec_hash(HklPair* pair, void* data)
{
  hklr_gc_dec((HklrObject*) pair->value);
}