int
slang_variable_scope_copy(slang_variable_scope * x,
                          const slang_variable_scope * y)
{
   slang_variable_scope z;
   unsigned int i;

   _slang_variable_scope_ctr(&z);
   z.variables = (slang_variable **)
      _slang_alloc(y->num_variables * sizeof(slang_variable *));
   if (z.variables == NULL) {
      slang_variable_scope_destruct(&z);
      return 0;
   }
   for (z.num_variables = 0; z.num_variables < y->num_variables;
        z.num_variables++) {
      z.variables[z.num_variables] = slang_variable_new();
      if (!z.variables[z.num_variables]) {
         slang_variable_scope_destruct(&z);
         return 0;
      }
   }
   for (i = 0; i < z.num_variables; i++) {
      if (!slang_variable_copy(z.variables[i], y->variables[i])) {
         slang_variable_scope_destruct(&z);
         return 0;
      }
   }
   z.outer_scope = y->outer_scope;
   slang_variable_scope_destruct(x);
   *x = z;
   return 1;
}
int slang_variable_scope_copy (slang_variable_scope *x, const slang_variable_scope *y)
{
	slang_variable_scope z;
	unsigned int i;

	if (!slang_variable_scope_construct (&z))
		return 0;
	z.variables = (slang_variable *) slang_alloc_malloc (y->num_variables * sizeof (slang_variable));
	if (z.variables == NULL)
	{
		slang_variable_scope_destruct (&z);
		return 0;
	}
	for (z.num_variables = 0; z.num_variables < y->num_variables; z.num_variables++)
		if (!slang_variable_construct (&z.variables[z.num_variables]))
		{
			slang_variable_scope_destruct (&z);
			return 0;
		}
	for (i = 0; i < z.num_variables; i++)
		if (!slang_variable_copy (&z.variables[i], &y->variables[i]))
		{
			slang_variable_scope_destruct (&z);
			return 0;
		}
	z.outer_scope = y->outer_scope;
	slang_variable_scope_destruct (x);
	*x = z;
	return 1;
}