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:
Akos Kiss
2018-09-17 10:07:24 +02:00
committed by László Langó
parent 2d83d8ed17
commit 3d3a8008a8
24 changed files with 367 additions and 389 deletions
+3 -3
View File
@@ -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);