mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
cleanup: replace strcmp by std::string methods
Since these are std::strings anyway, there seems to be no point in using the C-lib functions. YMMV, but to me that code is distinctly more easy to parse. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
66896ad7d7
commit
72ad4cedf5
1 changed files with 4 additions and 4 deletions
|
@ -14,19 +14,19 @@ struct fingerprint_table fingerprint_table;
|
||||||
|
|
||||||
static bool same_device(const device &dev1, const device &dev2)
|
static bool same_device(const device &dev1, const device &dev2)
|
||||||
{
|
{
|
||||||
return strcmp(dev1.model.c_str(), dev2.model.c_str()) == 0 &&
|
return dev1.model == dev2.model &&
|
||||||
strcmp(dev1.serialNumber.c_str(), dev2.serialNumber.c_str()) == 0;
|
dev1.serialNumber == dev2.serialNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool device::operator<(const device &a) const
|
bool device::operator<(const device &a) const
|
||||||
{
|
{
|
||||||
int diff;
|
int diff;
|
||||||
|
|
||||||
diff = strcmp(model.c_str(), a.model.c_str());
|
diff = model.compare(a.model);
|
||||||
if (diff)
|
if (diff)
|
||||||
return diff < 0;
|
return diff < 0;
|
||||||
|
|
||||||
return strcmp(serialNumber.c_str(), a.serialNumber.c_str()) < 0;
|
return serialNumber < a.serialNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" const struct device *get_device_for_dc(const struct device_table *table, const struct divecomputer *dc)
|
extern "C" const struct device *get_device_for_dc(const struct device_table *table, const struct divecomputer *dc)
|
||||||
|
|
Loading…
Add table
Reference in a new issue