[PATCH 3/3] Rename dive gas function and defines for clarity

Anton Lundin glance at acc.umu.se
Sun Jul 20 06:07:57 PDT 2014


This renames the dive gas functions to not talk about just nitrox, and
to instead talk about gas.

Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 divelist.c       | 12 ++++++------
 divelist.h       |  2 +-
 qt-ui/models.cpp |  2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/divelist.c b/divelist.c
index 1e279ef..75ad42f 100644
--- a/divelist.c
+++ b/divelist.c
@@ -434,14 +434,14 @@ void update_cylinder_related_info(struct dive *dive)
 	}
 }
 
-#define MAX_NITROX_STRING 80
+#define MAX_GAS_STRING 80
 #define UTF8_ELLIPSIS "\xE2\x80\xA6"
 
 /* callers needs to free the string */
-char *get_nitrox_string(struct dive *dive)
+char *get_dive_gas_string(struct dive *dive)
 {
 	int o2, he, o2low;
-	char *buffer = malloc(MAX_NITROX_STRING);
+	char *buffer = malloc(MAX_GAS_STRING);
 
 	if (buffer) {
 		get_dive_gas(dive, &o2, &he, &o2low);
@@ -450,12 +450,12 @@ char *get_nitrox_string(struct dive *dive)
 		o2low = (o2low + 5) / 10;
 
 		if (he)
-			snprintf(buffer, MAX_NITROX_STRING, "%d/%d", o2, he);
+			snprintf(buffer, MAX_GAS_STRING, "%d/%d", o2, he);
 		else if (o2)
 			if (o2 == o2low)
-				snprintf(buffer, MAX_NITROX_STRING, "%d", o2);
+				snprintf(buffer, MAX_GAS_STRING, "%d", o2);
 			else
-				snprintf(buffer, MAX_NITROX_STRING, "%d" UTF8_ELLIPSIS "%d", o2low, o2);
+				snprintf(buffer, MAX_GAS_STRING, "%d" UTF8_ELLIPSIS "%d", o2low, o2);
 		else
 			strcpy(buffer, translate("gettextFromC", "air"));
 	}
diff --git a/divelist.h b/divelist.h
index 4eafd5d..96722e8 100644
--- a/divelist.h
+++ b/divelist.h
@@ -15,7 +15,7 @@ extern double init_decompression(struct dive *dive);
 
 /* divelist core logic functions */
 extern void process_dives(bool imported, bool prefer_imported);
-extern char *get_nitrox_string(struct dive *dive);
+extern char *get_dive_gas_string(struct dive *dive);
 
 extern dive_trip_t *find_trip_by_idx(int idx);
 
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 588591f..8ff6e17 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -1131,7 +1131,7 @@ QVariant DiveItem::data(int column, int role) const
 			retVal = QString(dive->cylinder[0].type.description);
 			break;
 		case GAS:
-			retVal = QString(get_nitrox_string(dive));
+			retVal = QString(get_dive_gas_string(dive));
 			break;
 		case SAC:
 			retVal = displaySac();
-- 
1.9.1



More information about the subsurface mailing list