summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-04-09 22:30:46 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-04-10 08:16:33 -0700
commit8b0055d15c21d65520ae58c06ce2e5b5c85cf065 (patch)
tree162020e15af8b1cf35b51b1e5ba320e5ce6fe410
parentbbacdf94e325dbc78b4a6d60a297b6e330cc90c0 (diff)
downloadsubsurface-8b0055d15c21d65520ae58c06ce2e5b5c85cf065.tar.gz
Cleanup: remove unused function get_selected_dives_text()
The only caller was removed in commit c3f07b9f81f09421a92d42d1b98e7c984b75e20d. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r--core/statistics.c69
-rw-r--r--core/statistics.h1
2 files changed, 0 insertions, 70 deletions
diff --git a/core/statistics.c b/core/statistics.c
index eed24505c..9dd495b51 100644
--- a/core/statistics.c
+++ b/core/statistics.c
@@ -4,7 +4,6 @@
* core logic for the Info & Stats page -
* char *get_minutes(int seconds);
* void process_all_dives(struct dive *dive, struct dive **prev_dive);
- * void get_selected_dives_text(char *buffer, int size);
*/
#include "gettext.h"
#include <string.h>
@@ -235,74 +234,6 @@ void process_selected_dives(void)
stats_selection.selection_size = nr;
}
-/* this gets called when at least two but not all dives are selected */
-static void get_ranges(char *buffer, int size)
-{
- int i, len;
- int first = -1, last = -1;
- struct dive *dive;
-
- snprintf(buffer, size, "%s", translate("gettextFromC", "for dives #"));
- for_each_dive (i, dive) {
- if (!dive->selected)
- continue;
- if (dive->number < 1) {
- /* uhh - weird numbers - bail */
- snprintf(buffer, size, "%s", translate("gettextFromC", "for selected dives"));
- return;
- }
- len = strlen(buffer);
- if (last == -1) {
- snprintf(buffer + len, size - len, "%d", dive->number);
- first = last = dive->number;
- } else {
- if (dive->number == last + 1) {
- last++;
- continue;
- } else {
- if (first == last)
- snprintf(buffer + len, size - len, ", %d", dive->number);
- else if (first + 1 == last)
- snprintf(buffer + len, size - len, ", %d, %d", last, dive->number);
- else
- snprintf(buffer + len, size - len, "-%d, %d", last, dive->number);
- first = last = dive->number;
- }
- }
- }
- len = strlen(buffer);
- if (first != last) {
- if (first + 1 == last)
- snprintf(buffer + len, size - len, ", %d", last);
- else
- snprintf(buffer + len, size - len, "-%d", last);
- }
-}
-
-void get_selected_dives_text(char *buffer, size_t size)
-{
- if (amount_selected == 1) {
- if (current_dive)
- snprintf(buffer, size, translate("gettextFromC", "for dive #%d"), current_dive->number);
- else
- snprintf(buffer, size, "%s", translate("gettextFromC", "for selected dive"));
- } else if (amount_selected == (unsigned int)dive_table.nr) {
- snprintf(buffer, size, "%s", translate("gettextFromC", "for all dives"));
- } else if (amount_selected == 0) {
- snprintf(buffer, size, "%s", translate("gettextFromC", "(no dives)"));
- } else {
- get_ranges(buffer, size);
- if (strlen(buffer) == size - 1) {
- /* add our own ellipse... the way Pango does this is ugly
- * as it will leave partial numbers there which I don't like */
- size_t offset = 4;
- while (offset < size && isdigit(buffer[size - offset]))
- offset++;
- strcpy(buffer + size - offset, "...");
- }
- }
-}
-
#define SOME_GAS 5000 // 5bar drop in cylinder pressure makes cylinder used
bool has_gaschange_event(struct dive *dive, struct divecomputer *dc, int idx)
diff --git a/core/statistics.h b/core/statistics.h
index 8a71758f7..adc363e56 100644
--- a/core/statistics.h
+++ b/core/statistics.h
@@ -46,7 +46,6 @@ extern stats_t *stats_by_type;
extern char *get_minutes(int seconds);
extern void process_all_dives(struct dive *dive, struct dive **prev_dive);
-extern void get_selected_dives_text(char *buffer, size_t size);
extern void get_gas_used(struct dive *dive, volume_t gases[MAX_CYLINDERS]);
extern void process_selected_dives(void);
void selected_dives_gas_parts(volume_t *o2_tot, volume_t *he_tot);