From d48db1d5bdf7ab662819929d636706385ad12f5a Mon Sep 17 00:00:00 2001 From: Akos Kiss Date: Wed, 26 Apr 2017 01:05:33 +0200 Subject: [PATCH] Remove `jerry-internal.h` (#1782) The internal header was a legacy, declared two functions only. One of them was not used anymore at all, the other was used at a single call site. Moreover, their documentation was outdated. This patch removes the header and the related function implementations -- as well as the temptation to use such internal functions from outside the library. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu --- jerry-core/ecma/base/ecma-gc.c | 3 -- .../ecma/operations/ecma-function-object.c | 13 ++--- jerry-core/jerry-internal.h | 36 ------------- jerry-core/jerry.c | 51 ------------------- jerry-core/jrt/jrt-fatals.c | 3 -- 5 files changed, 5 insertions(+), 101 deletions(-) delete mode 100644 jerry-core/jerry-internal.h diff --git a/jerry-core/ecma/base/ecma-gc.c b/jerry-core/ecma/base/ecma-gc.c index 77269092e..0be7836b0 100644 --- a/jerry-core/ecma/base/ecma-gc.c +++ b/jerry-core/ecma/base/ecma-gc.c @@ -38,9 +38,6 @@ #include "ecma-promise-object.h" #endif -#define JERRY_INTERNAL -#include "jerry-internal.h" - /* TODO: Extract GC to a separate component */ /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/operations/ecma-function-object.c b/jerry-core/ecma/operations/ecma-function-object.c index 2184068d5..ff0f9ccf1 100644 --- a/jerry-core/ecma/operations/ecma-function-object.c +++ b/jerry-core/ecma/operations/ecma-function-object.c @@ -27,9 +27,6 @@ #include "ecma-try-catch-macro.h" #include "jcontext.h" -#define JERRY_INTERNAL -#include "jerry-internal.h" - /** \addtogroup ecma ECMA * @{ * @@ -539,12 +536,12 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */ else if (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_EXTERNAL_FUNCTION) { ecma_extended_object_t *ext_func_obj_p = (ecma_extended_object_t *) func_obj_p; + jerry_external_handler_t handler_p = (jerry_external_handler_t) ext_func_obj_p->u.external_function; - ret_value = jerry_dispatch_external_function (func_obj_p, - ext_func_obj_p->u.external_function, - this_arg_value, - arguments_list_p, - arguments_list_len); + ret_value = handler_p (ecma_make_object_value (func_obj_p), + this_arg_value, + arguments_list_p, + arguments_list_len); } else { diff --git a/jerry-core/jerry-internal.h b/jerry-core/jerry-internal.h deleted file mode 100644 index c1b60d58c..000000000 --- a/jerry-core/jerry-internal.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JERRY_INTERNAL - # error "The header is for Jerry's internal interfaces" -#endif /* !JERRY_INTERNAL */ - -#ifndef JERRY_INTERNAL_H -#define JERRY_INTERNAL_H - -#include "ecma-globals.h" -#include "jerryscript.h" - -ecma_value_t -jerry_dispatch_external_function (ecma_object_t *function_object_p, - ecma_external_pointer_t handler_p, - ecma_value_t this_arg_value, - const ecma_value_t *arguments_list_p, - ecma_length_t arguments_list_len); - -void -jerry_dispatch_object_free_callback (ecma_external_pointer_t freecb_p, ecma_external_pointer_t native_p); - -#endif /* !JERRY_INTERNAL_H */ diff --git a/jerry-core/jerry.c b/jerry-core/jerry.c index 7ca8a74ec..83b53908f 100644 --- a/jerry-core/jerry.c +++ b/jerry-core/jerry.c @@ -35,9 +35,6 @@ #include "js-parser.h" #include "re-compiler.h" -#define JERRY_INTERNAL -#include "jerry-internal.h" - JERRY_STATIC_ASSERT (sizeof (jerry_value_t) == sizeof (ecma_value_t), size_of_jerry_value_t_must_be_equal_to_size_of_ecma_value_t); @@ -2151,51 +2148,3 @@ jerry_is_valid_cesu8_string (const jerry_char_t *cesu8_buf_p, /**< CESU-8 string /** * @} */ - -/** - * ====================== Internal functions ========================== - */ - -/** - * Dispatch call to specified external function using the native handler - * - * Note: - * returned value must be freed with jerry_release_value, when it is no longer needed. - * - * @return returned ecma value of the invoked native function - if success - * thrown error - otherwise - */ -ecma_value_t -jerry_dispatch_external_function (ecma_object_t *function_object_p, /**< external function object */ - ecma_external_pointer_t handler_p, /**< pointer to the function's native handler */ - ecma_value_t this_arg_value, /**< 'this' argument */ - const ecma_value_t *arguments_list_p, /**< arguments list */ - ecma_length_t arguments_list_len) /**< arguments list length */ -{ - jerry_assert_api_available (); - - ecma_value_t ret_value = ((jerry_external_handler_t) handler_p) (ecma_make_object_value (function_object_p), - this_arg_value, - arguments_list_p, - arguments_list_len); - return ret_value; -} /* jerry_dispatch_external_function */ - -/** - * Dispatch call to object's native free callback function - * - * Note: - * the callback is called during critical GC phase, - * so should not perform any requests to engine. - */ -void -jerry_dispatch_object_free_callback (ecma_external_pointer_t freecb_p, /**< pointer to free callback handler */ - ecma_external_pointer_t native_p) /**< native handle, associated - * with freed object */ -{ - jerry_make_api_unavailable (); - - ((jerry_object_free_callback_t) freecb_p) ((uintptr_t) native_p); - - jerry_make_api_available (); -} /* jerry_dispatch_object_free_callback */ diff --git a/jerry-core/jrt/jrt-fatals.c b/jerry-core/jrt/jrt-fatals.c index 736aac5a3..d5d81706f 100644 --- a/jerry-core/jrt/jrt-fatals.c +++ b/jerry-core/jrt/jrt-fatals.c @@ -20,9 +20,6 @@ #include "jrt.h" #include "jrt-libc-includes.h" -#define JERRY_INTERNAL -#include "jerry-internal.h" - /* * Exit with specified status code. *