revert pessimization
revert part of
commit 113d9bba05
Author: Noel Grandin <noel.grandin@collabora.co.uk>
Date: Fri Sep 30 09:06:51 2022 +0200
use more string_view in stoc
<sberg> This is another case of a potential pessimization, for no
gain: The passed in schemeSpecificPart will always be an
OUString, and path may be a view of its full content
(if there is neither authority nor query part).
Change-Id: Ibc60fb1f5f351668ef924e25ee3aeb1d80f6f710
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141205
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -167,10 +167,10 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
css::uno::Reference< css::uri::XUriReference > parseGeneric(
|
css::uno::Reference< css::uri::XUriReference > parseGeneric(
|
||||||
OUString const & scheme, std::u16string_view schemeSpecificPart)
|
OUString const & scheme, OUString const & schemeSpecificPart)
|
||||||
{
|
{
|
||||||
size_t len = schemeSpecificPart.size();
|
sal_Int32 len = schemeSpecificPart.getLength();
|
||||||
size_t i = 0;
|
sal_Int32 i = 0;
|
||||||
bool hasAuthority = false;
|
bool hasAuthority = false;
|
||||||
OUString authority;
|
OUString authority;
|
||||||
if (len - i >= 2 && schemeSpecificPart[i] == '/'
|
if (len - i >= 2 && schemeSpecificPart[i] == '/'
|
||||||
@@ -183,22 +183,22 @@ css::uno::Reference< css::uri::XUriReference > parseGeneric(
|
|||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
hasAuthority = true;
|
hasAuthority = true;
|
||||||
authority = schemeSpecificPart.substr(n, i - n);
|
authority = schemeSpecificPart.copy(n, i - n);
|
||||||
}
|
}
|
||||||
sal_Int32 n = i;
|
sal_Int32 n = i;
|
||||||
i = schemeSpecificPart.find('?', i);
|
i = schemeSpecificPart.indexOf('?', i);
|
||||||
if (i == std::u16string_view::npos) {
|
if (i == -1) {
|
||||||
i = len;
|
i = len;
|
||||||
}
|
}
|
||||||
std::u16string_view path = schemeSpecificPart.substr(n, i - n);
|
OUString path = schemeSpecificPart.copy(n, i - n);
|
||||||
bool hasQuery = false;
|
bool hasQuery = false;
|
||||||
OUString query;
|
OUString query;
|
||||||
if (i != len) {
|
if (i != len) {
|
||||||
hasQuery = true;
|
hasQuery = true;
|
||||||
query = schemeSpecificPart.substr(i + 1);
|
query = schemeSpecificPart.copy(i + 1);
|
||||||
}
|
}
|
||||||
return new UriReference(
|
return new UriReference(
|
||||||
scheme, hasAuthority, authority, OUString(path), hasQuery, query);
|
scheme, hasAuthority, authority, path, hasQuery, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Segment {
|
struct Segment {
|
||||||
|
Reference in New Issue
Block a user