jscript: Use jsstr_substr in jsregexp.c where possible.
This commit is contained in:
parent
6e3895ad76
commit
20e85dd21b
|
@ -346,10 +346,10 @@ static HRESULT create_match_array(script_ctx_t *ctx, jsstr_t *input,
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
for(i=0; i < result->paren_count; i++) {
|
for(i=0; i < result->paren_count; i++) {
|
||||||
if(result->parens[i].index == -1)
|
if(result->parens[i].index != -1)
|
||||||
str = jsstr_empty();
|
str = jsstr_substr(input, result->parens[i].index, result->parens[i].length);
|
||||||
else
|
else
|
||||||
str = jsstr_alloc_len(input->str+result->parens[i].index, result->parens[i].length);
|
str = jsstr_empty();
|
||||||
if(!str) {
|
if(!str) {
|
||||||
hres = E_OUTOFMEMORY;
|
hres = E_OUTOFMEMORY;
|
||||||
break;
|
break;
|
||||||
|
@ -866,7 +866,7 @@ static HRESULT RegExpConstr_leftContext(script_ctx_t *ctx, vdisp_t *jsthis, WORD
|
||||||
case DISPATCH_PROPERTYGET: {
|
case DISPATCH_PROPERTYGET: {
|
||||||
jsstr_t *ret;
|
jsstr_t *ret;
|
||||||
|
|
||||||
ret = jsstr_alloc_len(ctx->last_match->str, ctx->last_match_index);
|
ret = jsstr_substr(ctx->last_match, 0, ctx->last_match_index);
|
||||||
if(!ret)
|
if(!ret)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
@ -892,7 +892,8 @@ static HRESULT RegExpConstr_rightContext(script_ctx_t *ctx, vdisp_t *jsthis, WOR
|
||||||
case DISPATCH_PROPERTYGET: {
|
case DISPATCH_PROPERTYGET: {
|
||||||
jsstr_t *ret;
|
jsstr_t *ret;
|
||||||
|
|
||||||
ret = jsstr_alloc(ctx->last_match->str+ctx->last_match_index+ctx->last_match_length);
|
ret = jsstr_substr(ctx->last_match, ctx->last_match_index+ctx->last_match_length,
|
||||||
|
jsstr_length(ctx->last_match) - ctx->last_match_index - ctx->last_match_length);
|
||||||
if(!ret)
|
if(!ret)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue