Commit 0e6d3b86 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Optimized concatenation of empty strings.

parent f0c0c142
......@@ -72,16 +72,19 @@ jsstr_t *jsstr_concat(jsstr_t *str1, jsstr_t *str2)
jsstr_t *ret;
len1 = jsstr_length(str1);
if(!len1)
return jsstr_addref(str2);
len2 = jsstr_length(str2);
if(!len2)
return jsstr_addref(str1);
ret = jsstr_alloc_buf(len1+len2);
if(!ret)
return NULL;
if(len1)
memcpy(ret->str, str1->str, len1*sizeof(WCHAR));
if(len2)
memcpy(ret->str+len1, str2->str, len2*sizeof(WCHAR));
memcpy(ret->str, str1->str, len1*sizeof(WCHAR));
memcpy(ret->str+len1, str2->str, len2*sizeof(WCHAR));
return ret;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment