diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-10-13 20:39:49 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-10-13 16:26:42 -0700 |
commit | 2e5913d2ba6c5b5c384121692045be52836ac6fa (patch) | |
tree | 07ec2dfc520f30584b47507684b78bb28c4d5c19 /icons/Emblem-earth.svg | |
parent | ff6c1a34ad362347e2a3903f3882837d8e455b73 (diff) | |
download | subsurface-2e5913d2ba6c5b5c384121692045be52836ac6fa.tar.gz |
core: fix detection of duplicate device names
Recently (c9b8584bd2) the sort criteria of the device-table
was changed from (model/id) to (id/model). However, that
messed with the detection of duplicate device names: there,
the code searched for the first element greater or equal
to (model / 0).
With the reversal of the sort criteria, this would now
always give the first element.
Therefore, do a simple non-binary search, which is much
more robust. The binary search was a silly and pointless
premature optimization anyway - don't do such things
if not necessary!
Since only one place in the code search for existence
for a model-name, fold the corresponding function into
that place.
Moreover, change the code to do a case-insensitive compare.
This is consistent with the dc_match_serial() code in
core/libdivecomputer.c, where matching models is
case-insensitive!
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'icons/Emblem-earth.svg')
0 files changed, 0 insertions, 0 deletions