1
0
mirror of https://git.savannah.gnu.org/git/gperf.git synced 2025-12-02 13:09:22 +00:00

Use an array-list instead of a linked-list of equiv.-classes, part 2.

* src/search.cc (Search::compute_partition): Fix a memory leak.
This commit is contained in:
Bruno Haible
2025-04-20 10:50:29 +02:00
parent e63c9b209e
commit aa03db7dda
2 changed files with 8 additions and 1 deletions

View File

@@ -1,3 +1,8 @@
2025-04-20 Bruno Haible <bruno@clisp.org>
Use an array-list instead of a linked-list of equiv.-classes, part 2.
* src/search.cc (Search::compute_partition): Fix a memory leak.
2025-04-20 Bruno Haible <bruno@clisp.org> 2025-04-20 Bruno Haible <bruno@clisp.org>
Use a hash table in compute_partition, part 2. Use a hash table in compute_partition, part 2.

View File

@@ -1068,7 +1068,9 @@ Search::compute_partition (bool *undetermined) const
{ {
/* Allocate a new EquivalenceClass and add it as the last element to /* Allocate a new EquivalenceClass and add it as the last element to
the partition. */ the partition. */
pindex = partition->_equclasses.add_last (* new EquivalenceClass()); char temp_storage[sizeof (EquivalenceClass)];
EquivalenceClass * temp_equclass = new (temp_storage) EquivalenceClass ();
pindex = partition->_equclasses.add_last (* temp_equclass);
/* Map this keyword (and all equivalent ones that will be seen later) /* Map this keyword (and all equivalent ones that will be seen later)
to the equivalence class number pindex. */ to the equivalence class number pindex. */