Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
5ab2ccae
Unverified
Commit
5ab2ccae
authored
Jan 05, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid calling cif::Category::size() too often
parent
1017d086
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
include/cif++/Cif++.hpp
+1
-0
src/Cif++.cpp
+4
-2
No files found.
include/cif++/Cif++.hpp
View file @
5ab2ccae
...
...
@@ -2152,6 +2152,7 @@ class Category
std
::
vector
<
ItemColumn
>
mColumns
;
ItemRow
*
mHead
;
ItemRow
*
mTail
;
size_t
mLastUniqueNr
=
0
;
class
CatIndex
*
mIndex
;
std
::
vector
<
Linked
>
mParentLinks
,
mChildLinks
;
...
...
src/Cif++.cpp
View file @
5ab2ccae
...
...
@@ -1601,11 +1601,13 @@ std::string Category::getUniqueID(std::function<std::string(int)> generator)
if
(
mCatValidator
!=
nullptr
and
mCatValidator
->
mKeys
.
size
()
==
1
)
key
=
mCatValidator
->
mKeys
.
front
();
size_t
nr
=
size
();
// calling size() often is a waste of resources
if
(
mLastUniqueNr
==
0
)
mLastUniqueNr
=
size
();
for
(;;)
{
std
::
string
result
=
generator
(
int
(
n
r
++
));
std
::
string
result
=
generator
(
static_cast
<
int
>
(
mLastUniqueN
r
++
));
if
(
exists
(
Key
(
key
)
==
result
))
continue
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment