[PATCH 3/4] ostctools_import: Switch to using dc_parser_new2

Anton Lundin glance at acc.umu.se
Thu Dec 29 07:08:49 PST 2016


Instead of creating the individual parsers, and keeping track of their
arguments, this just uses the "new" dc_parser_new2 function ment for
buffer parsing.

Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 core/libdivecomputer.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c
index 8a8b215..e912405 100644
--- a/core/libdivecomputer.c
+++ b/core/libdivecomputer.c
@@ -1082,26 +1082,12 @@ dc_status_t libdc_buffer_parser(struct dive *dive, device_data_t *data, unsigned
 	switch (dc_descriptor_get_type(data->descriptor)) {
 	case DC_FAMILY_UWATEC_ALADIN:
 	case DC_FAMILY_UWATEC_MEMOMOUSE:
-		rc = uwatec_memomouse_parser_create(&parser, data->context, 0, 0);
-		break;
 	case DC_FAMILY_UWATEC_SMART:
 	case DC_FAMILY_UWATEC_MERIDIAN:
-		rc = uwatec_smart_parser_create (&parser, data->context, dc_descriptor_get_model(data->descriptor), 0, 0);
-		break;
 	case DC_FAMILY_HW_OSTC:
-#if defined(SSRF_CUSTOM_SERIAL)
-		rc = hw_ostc_parser_create (&parser, data->context, data->deviceid, 0);
-#else
-		rc = hw_ostc_parser_create (&parser, data->context, data->deviceid);
-#endif
-		break;
 	case DC_FAMILY_HW_FROG:
 	case DC_FAMILY_HW_OSTC3:
-#if defined(SSRF_CUSTOM_SERIAL)
-		rc = hw_ostc_parser_create (&parser, data->context, data->deviceid, 1);
-#else
-		rc = hw_ostc_parser_create (&parser, data->context, data->deviceid);
-#endif
+		rc = dc_parser_new2(&parser, data->context, data->descriptor, 0, 0);
 		break;
 	default:
 		report_error("Device type not handled!");
-- 
2.9.3



More information about the subsurface mailing list