jscript: Optimized concatenation of empty strings.

This commit is contained in:
Jacek Caban 2012-12-18 11:16:34 +01:00 committed by Alexandre Julliard
parent f0c0c14241
commit 0e6d3b8611
1 changed files with 7 additions and 4 deletions

View File

@ -72,15 +72,18 @@ 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));
return ret;
}