Don't use strlen for string literals (#2517)
Their length (size) is known at compile time. Therefore `sizeof` is more efficient for them. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
@@ -28,7 +28,7 @@ static const jerry_object_native_info_t test_info =
|
||||
.free_cb = free_test_data
|
||||
};
|
||||
|
||||
static const char *strict_equal_source = "var x = function(a, b) {return a === b;}; x";
|
||||
static const jerry_char_t strict_equal_source[] = "var x = function(a, b) {return a === b;}; x";
|
||||
|
||||
static bool
|
||||
find_test_object_by_data (const jerry_value_t candidate,
|
||||
@@ -72,8 +72,8 @@ main (void)
|
||||
/* Render strict-equal as a function. */
|
||||
jerry_value_t parse_result = jerry_parse (NULL,
|
||||
0,
|
||||
(jerry_char_t *) strict_equal_source,
|
||||
strlen (strict_equal_source),
|
||||
strict_equal_source,
|
||||
sizeof (strict_equal_source) - 1,
|
||||
JERRY_PARSE_STRICT_MODE);
|
||||
TEST_ASSERT (!jerry_value_is_error (parse_result));
|
||||
jerry_value_t strict_equal = jerry_run (parse_result);
|
||||
|
||||
Reference in New Issue
Block a user