Repository: jerryscript-project/jerryscript
File: jerry-main/main-utils.c (C)

Code before:
  {
    jerry_value_t func_val = ret_value;
    ret_value = jerry_run (func_val);
    jerry_release_value (func_val);
  }

  free (str_buf_p);

  return ret_value;
} /* test262_eval_script */

/**
 * Init the $262 object
 */
static void
register_test262 (void)
{
  jerry_value_t global_obj = jerry_get_global_object ();
  jerry_value_t test262_object = jerry_create_object ();

  test262_register_function (test262_object, "detachArrayBuffer", test262_detach_array_buffer);
  test262_register_function (test262_object, "evalScript", test262_eval_script);
  test262_register_function (test262_object, "gc", jerryx_handler_gc);

  jerry_value_t prop_name = jerry_create_string ((const jerry_char_t *) "global");
  jerry_value_t result = jerry_set_property (test262_object, prop_name, global_obj);

  jerry_release_value (prop_name);
  assert (!jerry_value_is_error (result));

  prop_name = jerry_create_string ((const jerry_char_t *) "$262");
  result = jerry_set_property (global_obj, prop_name, test262_object);

  assert (!jerry_value_is_error (result));
  jerry_release_value (prop_name);

  jerry_release_value (global_obj);
  jerry_release_value (test262_object);
  jerry_release_value (result);
} /* register_test262 */
#endif /* defined (JERRY_TEST262) && (JERRY_TEST262 == 1) */

/**
 * Inits the engine and the debugger
 */
void
main_init_engine (main_args_t *arguments_p) /** main arguments */
{
  jerry_init (arguments_p->init_flags);

  if (arguments_p->option_flags & OPT_FLAG_DEBUG_SERVER)

Review comment (suggestion):
swap the lines:
```c
assert(..)
.._release_..(...)
```
and there is no need for an empty line after the result.

Code after:
    jerry_value_t func_val = ret_value;
    ret_value = jerry_run (func_val);
    jerry_release_value (func_val);
  }

  free (str_buf_p);

  return ret_value;
} /* test262_eval_script */

/**
 * Init the $262 object
 */
static void
register_test262 (void)
{
  jerry_value_t global_obj = jerry_get_global_object ();
  jerry_value_t test262_object = jerry_create_object ();

  test262_register_function (test262_object, "detachArrayBuffer", test262_detach_array_buffer);
  test262_register_function (test262_object, "evalScript", test262_eval_script);
  test262_register_function (test262_object, "gc", jerryx_handler_gc);

  jerry_value_t prop_name = jerry_create_string ((const jerry_char_t *) "global");
  jerry_value_t result = jerry_set_property (test262_object, prop_name, global_obj);
  assert (!jerry_value_is_error (result));
  jerry_release_value (prop_name);
  jerry_release_value (result);
  prop_name = jerry_create_string ((const jerry_char_t *) "$262");
  result = jerry_set_property (global_obj, prop_name, test262_object);

  jerry_release_value (prop_name);
  assert (!jerry_value_is_error (result));

  jerry_release_value (global_obj);
  jerry_release_value (test262_object);
  jerry_release_value (result);
} /* register_test262 */

/**
 * Inits the engine and the debugger
 */
void
main_init_engine (main_args_t *arguments_p) /** main arguments */
{
  jerry_init (arguments_p->init_flags);

  if (arguments_p->option_flags & OPT_FLAG_DEBUG_SERVER)
  {
    bool protocol = false;