1
0
forked from mirrors/0ad

Remove some unnecessary string copy related to substr.

Patch By: phosit
Differential Revision: https://code.wildfiregames.com/D4772
This was SVN commit r27271.
This commit is contained in:
vladislavbelov
2022-12-04 19:56:12 +00:00
parent b2f529c655
commit 2ef801f5d0
13 changed files with 73 additions and 40 deletions
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -28,6 +28,7 @@
#include "scriptinterface/ScriptRequest.h"
#include <string>
#include <string_view>
template <typename T>
JSI_GUIProxy<T>& JSI_GUIProxy<T>::Singleton()
@@ -307,7 +308,7 @@ bool JSI_GUIProxy<T>::delete_(JSContext* cx, JS::HandleObject proxy, JS::HandleI
return result.fail(JSMSG_BAD_PROP_ID);
// event handlers
if (propName.substr(0, 2) == "on")
if (std::string_view{propName}.substr(0, 2) == "on")
{
CStr eventName(propName.substr(2));
e->UnsetScriptHandler(eventName);