Skip to content

Conversation

@akosthekiss
Copy link
Member

The iotjs::String constructor automatically allocates at least
size+1 bytes for the data (that +1 byte for the terminating zero),
so there is no need for the +1 on the caller side.

Moreover, strcpy can work just as fine as strcat in this case,
since caller knows where the first string ends, so there is no need
to make strcat figure that out.

IoT.js-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu

@akosthekiss
Copy link
Member Author

As motivated by @zherczeg in jerryscript-project/jerryscript#813

@LaszloLango
Copy link
Contributor

LGTM

1 similar comment
@zherczeg
Copy link
Member

LGTM

The iotjs::String constructor automatically allocates at least
size+1 bytes for the data (that +1 byte for the terminating zero),
so there is no need for the +1 on the caller side.

Moreover, strcpy can work just as fine as strcat in this case,
since caller knows where the first string ends, so there is no need
to make strcat figure that out.

IoT.js-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
@akosthekiss akosthekiss merged commit dfdc98d into jerryscript-project:master Mar 25, 2016
@akosthekiss akosthekiss deleted the wrapeval-lens branch March 25, 2016 10:19
pmarcinkiew pushed a commit to pmarcinkiew/iotjs that referenced this pull request Aug 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants