Example #1
0
static void hklr_gc_collectwhite(HklObject* object)
{
  assert(object != NULL);

  if (object->color == HKL_COLOR_WHITE && !object->is_buffered)
  {
    object->color = HKL_COLOR_BLACK;

    switch (object->type)
    {
      // If the object is a hash table
      case HKL_TYPE_HASH:
        // Traverse the hash scanning every child
        hkl_hash_traverse(object->as.hash, hklr_gc_collectwhite_hash, NULL);
        break;

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

      default: break;
    }

    // queue up roots to free
    /* HKLR.gc_freed++;
    hklr_object_free(object);*/

    hkl_deque_push_back(HKLR.gc_to_free, object);
  }
}
Example #2
0
static bool hklr_array_add_list(void* expr, void* array)
{
  HklValue* value = hklr_expression_eval((HklrExpression*) expr);

  hkl_deque_push_back((HklDeque*) array, value);

  return false;
}