From 40a3e562b01de2827fa6c2c5fd9d46631f91dc36 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 25 Mar 2019 09:05:47 +0100 Subject: Cleanup: provide printGPSCoords in C and C++ versions printGPSCoords() returned a newly allocated C-style string. Most callers simply made a QString out of it and freed the C-style string. This is paradoxical, as printGPSCoords internally works with QStrings and converts them to C-style on return. Therefore, let printGPSCoords() return a QString and create a printGPSCoordsC() wrapper for the two C-callers. Signed-off-by: Berthold Stoeger --- core/subsurface-qt/DiveObjectHelper.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'core/subsurface-qt') diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp index 921d55bea..e126298ac 100644 --- a/core/subsurface-qt/DiveObjectHelper.cpp +++ b/core/subsurface-qt/DiveObjectHelper.cpp @@ -114,10 +114,7 @@ QString DiveObjectHelper::gps() const struct dive_site *ds = m_dive->dive_site; if (!ds) return QString(); - char *gps = printGPSCoords(&ds->location); - QString res = gps; - free(gps); - return res; + return printGPSCoords(&ds->location); } QString DiveObjectHelper::gps_decimal() const -- cgit v1.2.3-70-g09d2