| 477 | }; |
| 478 | |
| 479 | void StringFunctions::ReplacePrepare(FunctionContext* context, |
| 480 | FunctionContext::FunctionStateScope scope) { |
| 481 | if (scope != FunctionContext::FRAGMENT_LOCAL) return; |
| 482 | if (!context->IsArgConstant(1)) return; |
| 483 | DCHECK_EQ(context->GetArgType(1)->type, FunctionContext::TYPE_STRING); |
| 484 | StringVal* pattern = reinterpret_cast<StringVal*>(context->GetConstantArg(1)); |
| 485 | if (pattern->is_null || pattern->len == 0) return; |
| 486 | |
| 487 | struct ReplaceContext* replace = context->Allocate<ReplaceContext>(); |
| 488 | if (replace != nullptr) { |
| 489 | new(replace) ReplaceContext(pattern); |
| 490 | context->SetFunctionState(scope, replace); |
| 491 | } |
| 492 | } |
| 493 | |
| 494 | void StringFunctions::ReplaceClose(FunctionContext* context, |
| 495 | FunctionContext::FunctionStateScope scope) { |
nothing calls this directly
no test coverage detected