Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
b2ba8780
Commit
b2ba8780
authored
3 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Optimize directory path building with string_view
parent
fdc9c2e7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/llfilesystem/lldir.cpp
+4
-4
4 additions, 4 deletions
indra/llfilesystem/lldir.cpp
indra/llfilesystem/lldir.h
+3
-3
3 additions, 3 deletions
indra/llfilesystem/lldir.h
with
7 additions
and
7 deletions
indra/llfilesystem/lldir.cpp
+
4
−
4
View file @
b2ba8780
...
...
@@ -1108,20 +1108,20 @@ void LLDir::dumpCurrentDirectories(LLError::ELevel level)
LL_VLOGS
(
level
,
"AppInit"
,
"Directories"
)
<<
" UserSkinDir: "
<<
getUserSkinDir
()
<<
LL_ENDL
;
}
void
LLDir
::
append
(
std
::
string
&
destpath
,
const
std
::
string
&
name
)
const
void
LLDir
::
append
(
std
::
string
&
destpath
,
std
::
string
_view
name
)
const
{
// Delegate question of whether we need a separator to helper method.
SepOff
sepoff
(
needSep
(
destpath
,
name
));
if
(
sepoff
.
first
)
// do we need a separator?
{
destpath
+=
mDirDelimiter
;
destpath
.
append
(
mDirDelimiter
)
;
}
// If destpath ends with a separator, AND name starts with one, skip
// name's leading separator.
destpath
+=
name
.
substr
(
sepoff
.
second
);
destpath
.
append
(
name
.
substr
(
sepoff
.
second
)
)
;
}
LLDir
::
SepOff
LLDir
::
needSep
(
const
std
::
string
&
path
,
const
std
::
string
&
name
)
const
LLDir
::
SepOff
LLDir
::
needSep
(
std
::
string
_view
path
,
std
::
string
_view
name
)
const
{
if
(
path
.
empty
()
||
name
.
empty
())
{
...
...
This diff is collapsed.
Click to expand it.
indra/llfilesystem/lldir.h
+
3
−
3
View file @
b2ba8780
...
...
@@ -201,11 +201,11 @@ class LLDir
/// Append specified @a name to @a destpath, separated by getDirDelimiter()
/// if both are non-empty.
void
append
(
std
::
string
&
destpath
,
const
std
::
string
&
name
)
const
;
void
append
(
std
::
string
&
destpath
,
std
::
string
_view
name
)
const
;
/// Variadic form: append @a name0 and @a name1 and arbitrary other @a
/// names to @a destpath, separated by getDirDelimiter() as needed.
template
<
typename
...
NAMES
>
void
append
(
std
::
string
&
destpath
,
const
std
::
string
&
name0
,
const
std
::
string
&
name1
,
void
append
(
std
::
string
&
destpath
,
std
::
string
_view
name0
,
std
::
string
_view
name1
,
const
NAMES
&
...
names
)
const
{
// In a typical recursion case, we'd accept (destpath, name0, names).
...
...
@@ -230,7 +230,7 @@ class LLDir
protected
:
// Does an add() or append() call need a directory delimiter?
typedef
std
::
pair
<
bool
,
unsigned
short
>
SepOff
;
SepOff
needSep
(
const
std
::
string
&
path
,
const
std
::
string
&
name
)
const
;
SepOff
needSep
(
std
::
string
_view
path
,
std
::
string
_view
name
)
const
;
// build mSearchSkinDirs without adding duplicates
void
addSearchSkinDir
(
const
std
::
string
&
skindir
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment