Introducing ECMA_GET_NON_NULL_POINTER macro that is ECMA_GET_POINTER without NULL pointer check.
Replacing invocations of ECMA_GET_POINTER passing non-NULL argument with introduced ECMA_GET_NON_NULL_POINTER.
This commit is contained in:
@@ -61,7 +61,7 @@ ecma_builtin_array_object_is_array (ecma_value_t this_arg __unused, /**< 'this'
|
||||
|
||||
if (arg.value_type == ECMA_TYPE_OBJECT)
|
||||
{
|
||||
ecma_object_t *obj_p = ECMA_GET_POINTER (arg.value);
|
||||
ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (arg.value);
|
||||
|
||||
ecma_property_t *class_prop_p = ecma_get_internal_property (obj_p,
|
||||
ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
|
||||
@@ -100,7 +100,7 @@ ecma_builtin_boolean_prototype_object_value_of (ecma_value_t this) /**< this arg
|
||||
}
|
||||
else if (this.value_type == ECMA_TYPE_OBJECT)
|
||||
{
|
||||
ecma_object_t *obj_p = ECMA_GET_POINTER (this.value);
|
||||
ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (this.value);
|
||||
|
||||
ecma_property_t *class_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this) /**< this argu
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *obj_p = ECMA_GET_POINTER (this.value);
|
||||
ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (this.value);
|
||||
ecma_string_t *name_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_NAME);
|
||||
|
||||
ECMA_TRY_CATCH (name_get_completion,
|
||||
@@ -119,8 +119,8 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this) /**< this argu
|
||||
JERRY_ASSERT (name_to_str_completion.u.value.value_type == ECMA_TYPE_STRING);
|
||||
JERRY_ASSERT (msg_to_str_completion.u.value.value_type == ECMA_TYPE_STRING);
|
||||
|
||||
ecma_string_t *name_string_p = ECMA_GET_POINTER (name_to_str_completion.u.value.value);
|
||||
ecma_string_t *msg_string_p = ECMA_GET_POINTER (msg_to_str_completion.u.value.value);
|
||||
ecma_string_t *name_string_p = ECMA_GET_NON_NULL_POINTER (name_to_str_completion.u.value.value);
|
||||
ecma_string_t *msg_string_p = ECMA_GET_NON_NULL_POINTER (msg_to_str_completion.u.value.value);
|
||||
|
||||
ecma_string_t *ret_str_p;
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ ecma_builtin_error_dispatch_call (ecma_value_t *arguments_list_p, /**< arguments
|
||||
ecma_op_to_string (arguments_list_p[0]),
|
||||
ret_value);
|
||||
|
||||
ecma_string_t *message_string_p = ECMA_GET_POINTER (msg_to_str_completion.u.value.value);
|
||||
ecma_string_t *message_string_p = ECMA_GET_NON_NULL_POINTER (msg_to_str_completion.u.value.value);
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_COMMON,
|
||||
message_string_p);
|
||||
ret_value = ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
|
||||
|
||||
@@ -63,7 +63,7 @@ ecma_builtin_eval_error_dispatch_call (ecma_value_t *arguments_list_p, /**< argu
|
||||
ecma_op_to_string (arguments_list_p[0]),
|
||||
ret_value);
|
||||
|
||||
ecma_string_t *message_string_p = ECMA_GET_POINTER (msg_to_str_completion.u.value.value);
|
||||
ecma_string_t *message_string_p = ECMA_GET_NON_NULL_POINTER (msg_to_str_completion.u.value.value);
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_EVAL,
|
||||
message_string_p);
|
||||
ret_value = ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
|
||||
|
||||
@@ -105,7 +105,7 @@ ecma_builtin_global_object_is_nan (ecma_value_t this_arg __unused, /**< this arg
|
||||
|
||||
ECMA_TRY_CATCH (num_value, ecma_op_to_number (arg), ret_value);
|
||||
|
||||
ecma_number_t *num_p = ECMA_GET_POINTER (num_value.u.value.value);
|
||||
ecma_number_t *num_p = ECMA_GET_NON_NULL_POINTER (num_value.u.value.value);
|
||||
|
||||
bool is_nan = ecma_number_is_nan (*num_p);
|
||||
|
||||
@@ -134,7 +134,7 @@ ecma_builtin_global_object_is_finite (ecma_value_t this_arg __unused, /**< this
|
||||
|
||||
ECMA_TRY_CATCH (num_value, ecma_op_to_number (arg), ret_value);
|
||||
|
||||
ecma_number_t *num_p = ECMA_GET_POINTER (num_value.u.value.value);
|
||||
ecma_number_t *num_p = ECMA_GET_NON_NULL_POINTER (num_value.u.value.value);
|
||||
|
||||
bool is_finite = !(ecma_number_is_nan (*num_p)
|
||||
|| ecma_number_is_infinity (*num_p));
|
||||
|
||||
@@ -66,7 +66,7 @@ ecma_builtin_math_object_abs (ecma_value_t this_arg __unused, /**< 'this' argume
|
||||
|
||||
ecma_number_t *num_p = ecma_alloc_number ();
|
||||
|
||||
const ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_POINTER (arg_num_value.u.value.value);
|
||||
const ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg_num_value.u.value.value);
|
||||
|
||||
if (ecma_number_is_nan (arg_num))
|
||||
{
|
||||
@@ -202,7 +202,7 @@ ecma_builtin_math_object_exp (ecma_value_t this_arg __unused, /**< 'this' argume
|
||||
|
||||
ecma_number_t *num_p = ecma_alloc_number ();
|
||||
|
||||
const ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_POINTER (arg_num_value.u.value.value);
|
||||
const ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg_num_value.u.value.value);
|
||||
|
||||
if (ecma_number_is_nan (arg_num))
|
||||
{
|
||||
@@ -272,7 +272,7 @@ ecma_builtin_math_object_log (ecma_value_t this_arg __unused, /**< 'this' argume
|
||||
|
||||
ecma_number_t *num_p = ecma_alloc_number ();
|
||||
|
||||
const ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_POINTER (arg_num_value.u.value.value);
|
||||
const ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg_num_value.u.value.value);
|
||||
|
||||
if (ecma_number_is_nan (arg_num))
|
||||
{
|
||||
@@ -332,7 +332,7 @@ ecma_builtin_math_object_max (ecma_value_t this_arg __unused, /**< 'this' argume
|
||||
|
||||
if (!is_just_convert)
|
||||
{
|
||||
ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_POINTER (arg_num_value.u.value.value);
|
||||
ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg_num_value.u.value.value);
|
||||
|
||||
if (unlikely (ecma_number_is_nan (arg_num)))
|
||||
{
|
||||
@@ -423,7 +423,7 @@ ecma_builtin_math_object_min (ecma_value_t this_arg __unused, /**< 'this' argume
|
||||
|
||||
if (!is_just_convert)
|
||||
{
|
||||
ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_POINTER (arg_num_value.u.value.value);
|
||||
ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg_num_value.u.value.value);
|
||||
|
||||
if (unlikely (ecma_number_is_nan (arg_num)))
|
||||
{
|
||||
@@ -509,8 +509,8 @@ ecma_builtin_math_object_pow (ecma_value_t this_arg __unused, /**< 'this' argume
|
||||
|
||||
ecma_number_t *num_p = ecma_alloc_number ();
|
||||
|
||||
const ecma_number_t x = *(ecma_number_t*) ECMA_GET_POINTER (arg1_num_value.u.value.value);
|
||||
const ecma_number_t y = *(ecma_number_t*) ECMA_GET_POINTER (arg2_num_value.u.value.value);
|
||||
const ecma_number_t x = *(ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg1_num_value.u.value.value);
|
||||
const ecma_number_t y = *(ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg2_num_value.u.value.value);
|
||||
|
||||
if (ecma_number_is_nan (y)
|
||||
|| (ecma_number_is_nan (x)
|
||||
@@ -787,7 +787,7 @@ ecma_builtin_math_object_round (ecma_value_t this_arg __unused, /**< 'this' argu
|
||||
|
||||
ecma_number_t *num_p = ecma_alloc_number ();
|
||||
|
||||
const ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_POINTER (arg_num_value.u.value.value);
|
||||
const ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg_num_value.u.value.value);
|
||||
|
||||
if (ecma_number_is_nan (arg_num)
|
||||
|| ecma_number_is_zero (arg_num)
|
||||
@@ -859,7 +859,7 @@ ecma_builtin_math_object_sqrt (ecma_value_t this_arg __unused, /**< 'this' argum
|
||||
ecma_op_to_number (arg),
|
||||
ret_value);
|
||||
|
||||
const ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_POINTER (arg_num_value.u.value.value);
|
||||
const ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg_num_value.u.value.value);
|
||||
ecma_number_t ret_num;
|
||||
|
||||
if (ecma_number_is_nan (arg_num)
|
||||
|
||||
@@ -62,13 +62,13 @@ ecma_builtin_number_prototype_object_to_string (ecma_value_t this, /**< this arg
|
||||
|
||||
if (this.value_type == ECMA_TYPE_NUMBER)
|
||||
{
|
||||
ecma_number_t *this_arg_number_p = ECMA_GET_POINTER (this.value);
|
||||
ecma_number_t *this_arg_number_p = ECMA_GET_NON_NULL_POINTER (this.value);
|
||||
|
||||
this_arg_number = *this_arg_number_p;
|
||||
}
|
||||
else if (this.value_type == ECMA_TYPE_OBJECT)
|
||||
{
|
||||
ecma_object_t *obj_p = ECMA_GET_POINTER (this.value);
|
||||
ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (this.value);
|
||||
|
||||
ecma_property_t *class_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
|
||||
@@ -77,7 +77,7 @@ ecma_builtin_number_prototype_object_to_string (ecma_value_t this, /**< this arg
|
||||
ecma_property_t *prim_value_prop_p = ecma_get_internal_property (obj_p,
|
||||
ECMA_INTERNAL_PROPERTY_PRIMITIVE_NUMBER_VALUE);
|
||||
|
||||
ecma_number_t *prim_value_num_p = ECMA_GET_POINTER (prim_value_prop_p->u.internal_property.value);
|
||||
ecma_number_t *prim_value_num_p = ECMA_GET_NON_NULL_POINTER (prim_value_prop_p->u.internal_property.value);
|
||||
this_arg_number = *prim_value_num_p;
|
||||
}
|
||||
else
|
||||
@@ -134,7 +134,7 @@ ecma_builtin_number_prototype_object_value_of (ecma_value_t this) /**< this argu
|
||||
}
|
||||
else if (this.value_type == ECMA_TYPE_OBJECT)
|
||||
{
|
||||
ecma_object_t *obj_p = ECMA_GET_POINTER (this.value);
|
||||
ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (this.value);
|
||||
|
||||
ecma_property_t *class_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
|
||||
@@ -143,7 +143,7 @@ ecma_builtin_number_prototype_object_value_of (ecma_value_t this) /**< this argu
|
||||
ecma_property_t *prim_value_prop_p = ecma_get_internal_property (obj_p,
|
||||
ECMA_INTERNAL_PROPERTY_PRIMITIVE_NUMBER_VALUE);
|
||||
|
||||
ecma_number_t *prim_value_num_p = ECMA_GET_POINTER (prim_value_prop_p->u.internal_property.value);
|
||||
ecma_number_t *prim_value_num_p = ECMA_GET_NON_NULL_POINTER (prim_value_prop_p->u.internal_property.value);
|
||||
|
||||
ecma_number_t *ret_num_p = ecma_alloc_number ();
|
||||
*ret_num_p = *prim_value_num_p;
|
||||
|
||||
@@ -75,7 +75,7 @@ ecma_builtin_object_prototype_object_to_string (ecma_value_t this) /**< this arg
|
||||
|
||||
JERRY_ASSERT (obj_this.u.value.value_type == ECMA_TYPE_OBJECT);
|
||||
|
||||
ecma_object_t *obj_p = ECMA_GET_POINTER (obj_this.u.value.value);
|
||||
ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (obj_this.u.value.value);
|
||||
|
||||
ecma_property_t *class_prop_p = ecma_get_internal_property (obj_p,
|
||||
ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
|
||||
@@ -319,13 +319,13 @@ ecma_builtin_object_object_define_property (ecma_value_t this_arg __unused, /**<
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *obj_p = ECMA_GET_POINTER (arg1.value);
|
||||
ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (arg1.value);
|
||||
|
||||
ECMA_TRY_CATCH (name_str_value,
|
||||
ecma_op_to_string (arg2),
|
||||
ret_value);
|
||||
|
||||
ecma_string_t *name_str_p = ECMA_GET_POINTER (name_str_value.u.value.value);
|
||||
ecma_string_t *name_str_p = ECMA_GET_NON_NULL_POINTER (name_str_value.u.value.value);
|
||||
|
||||
ecma_property_descriptor_t prop_desc;
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ ecma_builtin_range_error_dispatch_call (ecma_value_t *arguments_list_p, /**< arg
|
||||
ecma_op_to_string (arguments_list_p[0]),
|
||||
ret_value);
|
||||
|
||||
ecma_string_t *message_string_p = ECMA_GET_POINTER (msg_to_str_completion.u.value.value);
|
||||
ecma_string_t *message_string_p = ECMA_GET_NON_NULL_POINTER (msg_to_str_completion.u.value.value);
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_RANGE,
|
||||
message_string_p);
|
||||
ret_value = ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
|
||||
|
||||
@@ -63,7 +63,7 @@ ecma_builtin_reference_error_dispatch_call (ecma_value_t *arguments_list_p, /**<
|
||||
ecma_op_to_string (arguments_list_p[0]),
|
||||
ret_value);
|
||||
|
||||
ecma_string_t *message_string_p = ECMA_GET_POINTER (msg_to_str_completion.u.value.value);
|
||||
ecma_string_t *message_string_p = ECMA_GET_NON_NULL_POINTER (msg_to_str_completion.u.value.value);
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_REFERENCE,
|
||||
message_string_p);
|
||||
ret_value = ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
|
||||
|
||||
@@ -62,7 +62,7 @@ ecma_builtin_string_prototype_object_to_string (ecma_value_t this) /**< this arg
|
||||
}
|
||||
else if (this.value_type == ECMA_TYPE_OBJECT)
|
||||
{
|
||||
ecma_object_t *obj_p = ECMA_GET_POINTER (this.value);
|
||||
ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (this.value);
|
||||
|
||||
ecma_property_t *class_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
|
||||
@@ -71,7 +71,7 @@ ecma_builtin_string_prototype_object_to_string (ecma_value_t this) /**< this arg
|
||||
ecma_property_t *prim_value_prop_p = ecma_get_internal_property (obj_p,
|
||||
ECMA_INTERNAL_PROPERTY_PRIMITIVE_STRING_VALUE);
|
||||
|
||||
ecma_string_t *prim_value_str_p = ECMA_GET_POINTER (prim_value_prop_p->u.internal_property.value);
|
||||
ecma_string_t *prim_value_str_p = ECMA_GET_NON_NULL_POINTER (prim_value_prop_p->u.internal_property.value);
|
||||
|
||||
prim_value_str_p = ecma_copy_or_ref_ecma_string (prim_value_str_p);
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ ecma_builtin_string_object_from_char_code (ecma_value_t this_arg __unused, /**<
|
||||
ret_value);
|
||||
|
||||
JERRY_ASSERT (arg_num_value.u.value.value_type == ECMA_TYPE_NUMBER);
|
||||
ecma_number_t *arg_num_p = ECMA_GET_POINTER (arg_num_value.u.value.value);
|
||||
ecma_number_t *arg_num_p = ECMA_GET_NON_NULL_POINTER (arg_num_value.u.value.value);
|
||||
|
||||
uint32_t uint32_char_code = ecma_number_to_uint32 (*arg_num_p);
|
||||
uint16_t uint16_char_code = (uint16_t) uint32_char_code;
|
||||
|
||||
@@ -63,7 +63,7 @@ ecma_builtin_syntax_error_dispatch_call (ecma_value_t *arguments_list_p, /**< ar
|
||||
ecma_op_to_string (arguments_list_p[0]),
|
||||
ret_value);
|
||||
|
||||
ecma_string_t *message_string_p = ECMA_GET_POINTER (msg_to_str_completion.u.value.value);
|
||||
ecma_string_t *message_string_p = ECMA_GET_NON_NULL_POINTER (msg_to_str_completion.u.value.value);
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_SYNTAX,
|
||||
message_string_p);
|
||||
ret_value = ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
|
||||
|
||||
@@ -63,7 +63,7 @@ ecma_builtin_type_error_dispatch_call (ecma_value_t *arguments_list_p, /**< argu
|
||||
ecma_op_to_string (arguments_list_p[0]),
|
||||
ret_value);
|
||||
|
||||
ecma_string_t *message_string_p = ECMA_GET_POINTER (msg_to_str_completion.u.value.value);
|
||||
ecma_string_t *message_string_p = ECMA_GET_NON_NULL_POINTER (msg_to_str_completion.u.value.value);
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_TYPE,
|
||||
message_string_p);
|
||||
ret_value = ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
|
||||
|
||||
@@ -63,7 +63,7 @@ ecma_builtin_uri_error_dispatch_call (ecma_value_t *arguments_list_p, /**< argum
|
||||
ecma_op_to_string (arguments_list_p[0]),
|
||||
ret_value);
|
||||
|
||||
ecma_string_t *message_string_p = ECMA_GET_POINTER (msg_to_str_completion.u.value.value);
|
||||
ecma_string_t *message_string_p = ECMA_GET_NON_NULL_POINTER (msg_to_str_completion.u.value.value);
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_URI,
|
||||
message_string_p);
|
||||
ret_value = ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
|
||||
|
||||
Reference in New Issue
Block a user