mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Undo: don't store insertion index in undo command
When adding dives in an undo command, the index is saved in the command. This seemed logical at first, because why calculate the index more than once? But actually it made the code rather subtle and brittle when multiple dives were added. Moreover, this is a pointless optimization, as it doesn't optimize the common case (only one execution). Remove this for now and calculate the index on every execution. If it ever turns out to be a bottle neck, it will be much more effective to turn the linear search of the index into a binary search. A further sensible optimization would be inserting in batches. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
1bc977452d
commit
5729f93e1f
2 changed files with 10 additions and 32 deletions
|
|
@ -16,7 +16,6 @@ struct DiveToAdd {
|
|||
OwningDivePtr dive; // Dive to add
|
||||
dive_trip *trip; // Trip the dive belongs to, may be null
|
||||
dive_site *site; // Site the dive is associated with, may be null
|
||||
int idx; // Position in divelist
|
||||
};
|
||||
|
||||
// Multiple trips, dives and dive sites that have to be added for a command
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue