Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b46ace51
Commit
b46ace51
authored
Apr 25, 2013
by
Jacek Caban
Committed by
Alexandre Julliard
Apr 25, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Optimize String.concat implementation.
parent
f5d64e06
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
10 deletions
+39
-10
string.c
dlls/jscript/string.c
+39
-10
No files found.
dlls/jscript/string.c
View file @
b46ace51
...
...
@@ -377,26 +377,52 @@ static HRESULT String_charCodeAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
static
HRESULT
String_concat
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
unsigned
len
=
0
,
i
,
str_cnt
;
jsstr_t
**
strs
,
*
ret
=
NULL
;
WCHAR
*
ptr
;
jsstr_t
*
ret
,
*
str
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
str_cnt
=
argc
+
1
;
hres
=
get_string_val
(
ctx
,
jsthis
,
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
switch
(
argc
)
{
case
0
:
ret
=
str
;
break
;
case
1
:
{
jsstr_t
*
arg_str
;
hres
=
to_string
(
ctx
,
argv
[
0
],
&
arg_str
);
if
(
FAILED
(
hres
))
{
jsstr_release
(
str
);
return
hres
;
}
ret
=
jsstr_concat
(
str
,
arg_str
);
jsstr_release
(
str
);
if
(
!
ret
)
return
E_OUTOFMEMORY
;
break
;
}
default:
{
const
unsigned
str_cnt
=
argc
+
1
;
unsigned
len
=
0
,
i
;
jsstr_t
**
strs
;
WCHAR
*
ptr
;
strs
=
heap_alloc_zero
(
str_cnt
*
sizeof
(
*
strs
));
if
(
!
strs
)
if
(
!
strs
)
{
jsstr_release
(
str
);
return
E_OUTOFMEMORY
;
}
hres
=
to_string
(
ctx
,
jsval_disp
(
jsthis
->
u
.
disp
),
strs
);
if
(
SUCCEEDED
(
hres
))
{
strs
[
0
]
=
str
;
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
hres
=
to_string
(
ctx
,
argv
[
i
],
strs
+
i
+
1
);
if
(
FAILED
(
hres
))
break
;
}
}
if
(
SUCCEEDED
(
hres
))
{
for
(
i
=
0
;
i
<
str_cnt
;
i
++
)
{
...
...
@@ -407,6 +433,7 @@ static HRESULT String_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
}
}
if
(
SUCCEEDED
(
hres
))
{
ptr
=
jsstr_alloc_buf
(
len
,
&
ret
);
if
(
ptr
)
{
for
(
i
=
0
;
i
<
str_cnt
;
i
++
)
...
...
@@ -415,13 +442,15 @@ static HRESULT String_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
hres
=
E_OUTOFMEMORY
;
}
}
}
for
(
i
=
0
;
i
<
str_cnt
;
i
++
)
while
(
i
--
)
jsstr_release
(
strs
[
i
]);
heap_free
(
strs
);
if
(
FAILED
(
hres
))
return
hres
;
}
}
if
(
r
)
*
r
=
jsval_string
(
ret
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment