Skip to content

Commit 7ca0a48

Browse files
committed
Reduce the usage of strlen
* Improve jerry_string_sz only accept UTF-8 string(that's a rare case accept CESU-8 in c/cpp code) * The document about jerry_string_sz only support ASCII(the fact is CESU-8 before this MR), update it to support UTF-8 after this MR * Improve all _sz function to take jerry_value_t that can construct from `jerry_string_sz` * Improve JERRY_ZSTR_ARG can only accept string literal(that's UTF-8) * Add function jerry_value_list_free to free a list of jerry_value_t * All call to jerry_string/jerry_string_cesu8 in core indeed are removed, so when there is no linkage to it, code size is saved The prototype of new/improved function/macros is: ```c jerry_value_t jerry_string_cesu8 (const jerry_char_t *buffer_p, jerry_size_t buffer_size); jerry_value_t jerry_string_utf8 (const jerry_char_t *buffer_p, jerry_size_t buffer_size); #define jerry_string_sz(str) jerry_string_utf8 (JERRY_ZSTR_ARG (str)) jerry_value_t jerry_error_sz (jerry_error_t error_type, const jerry_value_t message_sz); jerry_value_t jerry_throw_sz (jerry_error_t error_type, const jerry_value_t message_sz); jerry_value_t jerry_regexp_sz (const jerry_value_t pattern_sz, uint16_t flags); jerry_value_t jerry_object_delete_sz (const jerry_value_t object, const jerry_value_t key_sz); jerry_value_t jerry_object_get_sz (const jerry_value_t object, const jerry_value_t key_sz); jerry_value_t jerry_object_has_sz (const jerry_value_t object, const jerry_value_t key_sz); jerry_value_t jerry_object_set_sz (jerry_value_t object, const jerry_value_t key_sz, const jerry_value_t value); ``` Rename jerry_port_log to jerry_port_log_buffer Add buffer_size parameter for function jerry_port_log_buffer, so that jerry_port_log_buffer won't need calculate strlen when printing JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
1 parent c509a06 commit 7ca0a48

File tree

93 files changed

+979
-807
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+979
-807
lines changed

docs/01.CONFIGURATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ Enabling this feature provides detailed error messages where available, like lin
155155

156156
### Logging
157157

158-
This option can be used to enable log messages during runtime. When enabled the engine will use the `jerry_port_log` port API function to print relevant log messages.
158+
This option can be used to enable log messages during runtime. When enabled the engine will use the `jerry_port_log_buffer` port API function to print relevant log messages.
159159
This feature is disabled by default.
160160

161161
| Options | |

0 commit comments

Comments
 (0)