Berthold Stoeger 2e5913d2ba 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>
2020-10-13 16:26:42 -07:00
..
2020-04-19 14:27:54 -07:00
2019-08-08 08:56:44 -07:00
2019-08-08 16:26:31 -07:00
2017-04-29 13:32:55 -07:00
2020-09-29 16:13:03 -07:00
2020-10-05 10:17:29 +02:00
2018-10-21 19:55:09 +03:00
2020-03-01 10:21:44 -08:00
2020-01-27 09:51:31 -08:00
2020-04-18 13:41:29 +02:00
2019-12-13 07:04:00 -05:00
2020-10-05 10:17:29 +02:00
2017-04-29 13:32:55 -07:00
2020-03-10 17:42:54 -07:00
2020-03-10 17:42:54 -07:00
2020-05-03 15:02:21 -07:00
2019-11-09 19:19:04 +01:00