mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
devices: add index based device removal function
The undo machinery will need a method to remove devices based on their index instead of their name. Add it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
fa7dfa3710
commit
3a2f1b17b6
2 changed files with 8 additions and 0 deletions
|
@ -319,6 +319,13 @@ extern "C" int remove_device(struct device_table *device_table, const struct dev
|
|||
}
|
||||
}
|
||||
|
||||
extern "C" void remove_from_device_table(struct device_table *device_table, int idx)
|
||||
{
|
||||
if (idx < 0 || idx >= (int)device_table->devices.size())
|
||||
return;
|
||||
device_table->devices.erase(device_table->devices.begin() + idx);
|
||||
}
|
||||
|
||||
extern "C" void clear_device_table(struct device_table *device_table)
|
||||
{
|
||||
device_table->devices.clear();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue