17
17
18
18
#include "lit-strings.h"
19
19
20
- /**
21
- * Lengths of magic strings
22
- */
23
- static lit_magic_size_t lit_magic_string_sizes [LIT_MAGIC_STRING__COUNT ];
24
-
25
20
/**
26
21
* External magic strings data array, count and lengths
27
22
*/
@@ -36,32 +31,6 @@ static const lit_utf8_size_t *lit_magic_string_ex_sizes = NULL;
36
31
static ecma_length_t ecma_magic_string_max_length ;
37
32
#endif /* JERRY_NDEBUG */
38
33
39
- /**
40
- * Initialize data for string helpers
41
- */
42
- void
43
- lit_magic_strings_init (void )
44
- {
45
- /* Initializing magic strings information */
46
-
47
- #ifndef JERRY_NDEBUG
48
- ecma_magic_string_max_length = 0 ;
49
- #endif /* !JERRY_NDEBUG */
50
-
51
- for (lit_magic_string_id_t id = (lit_magic_string_id_t ) 0 ;
52
- id < LIT_MAGIC_STRING__COUNT ;
53
- id = (lit_magic_string_id_t ) (id + 1 ))
54
- {
55
- lit_magic_string_sizes [id ] = (lit_magic_size_t ) lit_zt_utf8_string_size (lit_get_magic_string_utf8 (id ));
56
-
57
- #ifndef JERRY_NDEBUG
58
- ecma_magic_string_max_length = JERRY_MAX (ecma_magic_string_max_length , lit_magic_string_sizes [id ]);
59
-
60
- JERRY_ASSERT (ecma_magic_string_max_length <= LIT_MAGIC_STRING_LENGTH_LIMIT );
61
- #endif /* !JERRY_NDEBUG */
62
- }
63
- } /* lit_magic_strings_init */
64
-
65
34
/**
66
35
* Initialize external magic strings
67
36
*/
@@ -114,6 +83,16 @@ lit_get_magic_string_utf8 (lit_magic_string_id_t id) /**< magic string id */
114
83
lit_utf8_size_t
115
84
lit_get_magic_string_size (lit_magic_string_id_t id ) /**< magic string id */
116
85
{
86
+ static const lit_magic_size_t lit_magic_string_sizes [] =
87
+ {
88
+ #define LIT_MAGIC_STRING_DEF (id , utf8_string ) \
89
+ sizeof (utf8_string ) - 1 ,
90
+ #include "lit-magic-strings.inc.h"
91
+ #undef LIT_MAGIC_STRING_DEF
92
+ };
93
+
94
+ JERRY_ASSERT (id < LIT_MAGIC_STRING__COUNT );
95
+
117
96
return lit_magic_string_sizes [id ];
118
97
} /* lit_get_magic_string_size */
119
98
0 commit comments