Skip to content

Turn some global variables static const #892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jerry-core/parser/js/js-lexer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1904,12 +1904,12 @@ lexer_expect_identifier (parser_context_t *context_p, /**< context */
parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);
} /* lexer_expect_identifier */

static lexer_lit_location_t lexer_get_literal =
static const lexer_lit_location_t lexer_get_literal =
{
(const uint8_t *) "get", 3, LEXER_IDENT_LITERAL, PARSER_FALSE
};

static lexer_lit_location_t lexer_set_literal =
static const lexer_lit_location_t lexer_set_literal =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A qestion: the compiler should complain that lexer_same_identifiers arguments should be const. Did you run make precommit?

{
(const uint8_t *) "set", 3, LEXER_IDENT_LITERAL, PARSER_FALSE
};
Expand Down
4 changes: 2 additions & 2 deletions jerry-core/vm/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@ vm_init (ecma_compiled_code_t *program_p, /**< pointer to byte-code data */
/**
* Decode table for opcodes.
*/
uint32_t vm_decode_table[] =
static const uint32_t vm_decode_table[] =
{
CBC_OPCODE_LIST
};

/**
* Decode table for extended opcodes.
*/
uint32_t vm_ext_decode_table[] =
static const uint32_t vm_ext_decode_table[] =
{
CBC_EXT_OPCODE_LIST
};
Expand Down