Skip to content

Commit 5faf1d0

Browse files
committed
Revert "Add string_pool_clear_thread() function"
This reverts commit 1d3c37d.
1 parent 73070f8 commit 5faf1d0

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

src/scratch/string_pool.cpp

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
#include <cassert>
1111
#include <algorithm>
1212

13-
#include "string_pool_p.h"
14-
1513
namespace libscratchcpp
1614
{
1715

@@ -77,26 +75,18 @@ void string_pool_add_thread(Thread *thread)
7775
}
7876

7977
void string_pool_remove_thread(Thread *thread)
80-
{
81-
string_pool_clear_thread(thread);
82-
threadStrings.erase(thread);
83-
84-
if (currentThread == thread)
85-
currentThread = nullptr;
86-
}
87-
88-
void string_pool_clear_thread(Thread *thread)
8978
{
9079
// Free all strings in the thread (garbage collection)
9180
assert(threadStrings.find(thread) != threadStrings.cend());
9281
auto &strings = threadStrings[thread];
9382

94-
for (StringPtr *str : strings) {
95-
assert(std::find_if(freeStrings.begin(), freeStrings.end(), [str](const std::pair<size_t, StringPtr *> &p) { return p.second == str; }) == freeStrings.end());
83+
for (StringPtr *str : strings)
9684
freeStrings.insert(std::pair<size_t, StringPtr *>(str->allocatedSize, str));
97-
}
9885

99-
strings.clear();
86+
threadStrings.erase(thread);
87+
88+
if (currentThread == thread)
89+
currentThread = nullptr;
10090
}
10191

10292
void string_pool_set_thread(Thread *thread)

src/scratch/string_pool_p.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ class Thread;
77

88
void string_pool_add_thread(Thread *thread);
99
void string_pool_remove_thread(Thread *thread);
10-
void string_pool_clear_thread(Thread *thread);
1110
void string_pool_set_thread(Thread *thread);
1211

1312
} // namespace libscratchcpp

0 commit comments

Comments
 (0)