Skip to content

Commit b81d4de

Browse files
authored
Improve internal string allocation methods (#398)
String values are allocated as temporary or final results. This commit attempts to improve the consistency and performance of this step. - define `JS_NewString` as an inline function to allow simple expansion of `strlen()` for string literals - document string contents constraints regarding UTF-8 encoding. - rename `js_new_string8` as `js_new_string8_len`. takes `const char *`. - new inline function `js_new_string8` takes `const char *`, computes string length with `strlen` and calls `js_new_string8_len`. No overhead for string literals - rename `js_new_string16` to `js_new_string16_len` - use internal string allocation functions where appropriate, remove overhead - allocate extra byte for null terminator in source code string
1 parent f9ecc1a commit b81d4de

File tree

2 files changed

+108
-70
lines changed

2 files changed

+108
-70
lines changed

0 commit comments

Comments
 (0)