Пример #1
0
value_t new_heap_array(runtime_t *runtime, size_t length) {
  size_t size = calc_array_size(length);
  TRY_DEF(result, alloc_heap_object(runtime, size,
      ROOT(runtime, mutable_array_species)));
  set_array_length(result, length);
  for (size_t i = 0; i < length; i++)
    set_array_at(result, i, null());
  return post_create_sanity_check(result, size);
}
Пример #2
0
/* Make a version of tdecl (an array type) with its length set to the 
   length of the e (a string constant) */
static type set_string_length(type tdecl, expression e)
{
  return set_array_length(tdecl, string_constant_length(e));
}