b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] alfred: gpsd: Fix build against gpsd 3.25
@ 2023-01-21 17:31 Sven Eckelmann
  0 siblings, 0 replies; only message in thread
From: Sven Eckelmann @ 2023-01-21 17:31 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Bjørn Forsman

gpsd moved in commit 35fe48835da0 ("include/gps.h: Move fixsource_t into
gps.h, add into gps_data_t.") the function gpsd_source_spec + its data
structures from the private gpsdclient.h to the public API header gps.h.
But the actual API major or minor version was not increased in this
process.

It is therefore not easily possible to figure out whether the libgps API
will provide this functionality or not. To avoid a conflict during the
build, just rename fixsource_t and gpsd_source_spec.

Reported-by: Bjørn Forsman <bjorn.forsman@gmail.com>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 gpsd/alfred-gpsd.c | 11 +++++++----
 gpsd/alfred-gpsd.h |  8 +++++---
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/gpsd/alfred-gpsd.c b/gpsd/alfred-gpsd.c
index 20b3d98..d0bd47c 100644
--- a/gpsd/alfred-gpsd.c
+++ b/gpsd/alfred-gpsd.c
@@ -217,8 +217,11 @@ static int gpsd_read_answer(struct globals *globals)
 	return 0;
 }
 
-/* Standard parsing of a GPS data source spec. Taken from gpsdclient.c */
-static void gpsd_source_spec(const char *arg, struct fixsource_t *source)
+/* Standard parsing of a GPS data source spec. Taken from gpsdclient.c
+ * remove when gpsd 3.25 is minimum supported version
+ */
+static void alfred_gpsd_source_spec(const char *arg,
+				    struct alfred_gpsd_fixsource_t *source)
 {
 	/* the casts attempt to head off a -Wwrite-strings warning */
 	source->server = (char *)"localhost";
@@ -425,7 +428,7 @@ static struct globals *gpsd_init(int argc, char *argv[])
 			gpsd_parse_location(globals, optarg);
 			break;
 		case 'g':
-			gpsd_source_spec(optarg, &globals->gpsdsource);
+			alfred_gpsd_source_spec(optarg, &globals->gpsdsource);
 			have_source = true;
 			break;
 		case 'u':
@@ -443,7 +446,7 @@ static struct globals *gpsd_init(int argc, char *argv[])
 	}
 
 	if (globals->source == SOURCE_GPSD && !have_source)
-		gpsd_source_spec(NULL, &globals->gpsdsource);
+		alfred_gpsd_source_spec(NULL, &globals->gpsdsource);
 
 	if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
 		perror("could not register SIGPIPE handler");
diff --git a/gpsd/alfred-gpsd.h b/gpsd/alfred-gpsd.h
index 38588ad..174ca14 100644
--- a/gpsd/alfred-gpsd.h
+++ b/gpsd/alfred-gpsd.h
@@ -60,8 +60,10 @@ struct gpsd_v1 {
 #define GPSD_DATA_SIZE(gpsd_data)	\
 	(sizeof(*gpsd_data) + (ntohl(gpsd_data->tpv_len)))
 
-/* struct taken from gpsdclient.h */
-struct fixsource_t
+/* struct taken from gpsdclient.h
+ * remove when gpsd 3.25 is minimum supported version
+ */
+struct alfred_gpsd_fixsource_t
 {
 	char *spec;         /* pointer to actual storage */
 	char *server;
@@ -84,7 +86,7 @@ struct globals {
 	int unix_sock;
 	const char *unix_path;
 
-	struct fixsource_t gpsdsource;
+	struct alfred_gpsd_fixsource_t gpsdsource;
 	struct gps_data_t gpsdata;
 	char * tpv;
 };

---
base-commit: 1ff43b3ea32b0f6cdea2440c4beaf001090370ff
change-id: 20230121-gpsd_3-25-34e854104d05

Best regards,
-- 
Sven Eckelmann <sven@narfation.org>

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-21 17:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-21 17:31 [PATCH] alfred: gpsd: Fix build against gpsd 3.25 Sven Eckelmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).