-
Notifications
You must be signed in to change notification settings - Fork 683
Modify the usage of ecma_string_to_utf8_string() #1119
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
Modify the usage of ecma_string_to_utf8_string() #1119
Conversation
@@ -674,7 +671,7 @@ ecma_string_get_array_index (const ecma_string_t *str_p, /**< ecma-string */ | |||
* | |||
* @return number of bytes, actually copied to the buffer. | |||
*/ | |||
lit_utf8_size_t __attr_return_value_should_be_checked___ | |||
lit_utf8_size_t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we use the return value anywhere?
6854ef8
to
dcdf698
Compare
Thanks for the reviews, I've updated the PR. |
* (can be NULL if buffer_size == 0) */ | ||
lit_utf8_size_t buffer_size) /**< size of buffer */ | ||
{ | ||
JERRY_ASSERT (ecma_string_get_size (string_desc_p) == buffer_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this assert is unnecessary, since the <= is checked by ecma_string_copy_to_utf8_buffer and size == buffer_size checks the equality.
LGTM after that |
dcdf698
to
4a2f9d5
Compare
LGTM |
1 similar comment
LGTM |
Parts: * Rename ecma_string_to_utf8_string() to ecma_string_copy_to_utf8_buffer. * Introduce ecma_string_to_utf8_bytes(), which wraps the usual 'function call-assertion' pair, and check strict equality of size of the string and the buffer. JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
4a2f9d5
to
c557a0a
Compare
Parts:
is already checked by the function itself, therefore we can remove some
local variables, which serves this purpose.
and remove the attribute itself, because it became unused in the project.
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com