summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libgps.h3
-rw-r--r--libgps_core.c4
-rw-r--r--libgps_dbus.c4
-rw-r--r--libgps_shm.c4
4 files changed, 9 insertions, 6 deletions
diff --git a/libgps.h b/libgps.h
index 91748e84..fb26ac2c 100644
--- a/libgps.h
+++ b/libgps.h
@@ -23,6 +23,9 @@ enum export_t {
#endif /* DBUS_EXPORT_ENABLE */
};
+/* values to poke in the gps_fd member if we get it via something special */
+#define SHM_PSEUDO_FD -1
+#define DBUS_PSEUDO_FD -2
extern int gps_sock_open(/*@null@*/const char *, /*@null@*/const char *,
/*@out@*/struct gps_data_t *);
diff --git a/libgps_core.c b/libgps_core.c
index e6c85824..25600ea3 100644
--- a/libgps_core.c
+++ b/libgps_core.c
@@ -217,11 +217,11 @@ int gps_mainloop(struct gps_data_t *gpsdata, int timeout,
/*@ -usedef -compdef -uniondef @*/
#ifdef SHM_EXPORT_ENABLE
- if ((intptr_t)(gpsdata->gps_fd) == -1)
+ if ((intptr_t)(gpsdata->gps_fd) == SHM_PSEUDO_FD)
status = gps_shm_mainloop(gpsdata, timeout, hook);
#endif /* SHM_EXPORT_ENABLE */
#ifdef DBUS_EXPORT_ENABLE
- if ((intptr_t)(gpsdata->gps_fd) == -2)
+ if ((intptr_t)(gpsdata->gps_fd) == DBUS_PSEUDO_FD)
status = gps_dbus_mainloop(gpsdata, timeout, hook);
#endif /* DBUS_EXPORT_ENABLE */
#ifdef SOCKET_EXPORT_ENABLE
diff --git a/libgps_dbus.c b/libgps_dbus.c
index c35afad1..79bddced 100644
--- a/libgps_dbus.c
+++ b/libgps_dbus.c
@@ -125,9 +125,9 @@ int gps_dbus_open(struct gps_data_t *gpsdata)
}
#ifndef USE_QT
- gpsdata->gps_fd = -2;
+ gpsdata->gps_fd = DBUS_PSEUDO_FD;
#else
- gpsdata->gps_fd = (void *)(intptr_t)-2;
+ gpsdata->gps_fd = (void *)(intptr_t)DBUS_PSEUDO_FD;
#endif /* USE_QT */
share_gpsdata = gpsdata;
return 0;
diff --git a/libgps_shm.c b/libgps_shm.c
index 7704730a..4ba4d309 100644
--- a/libgps_shm.c
+++ b/libgps_shm.c
@@ -59,9 +59,9 @@ int gps_shm_open(/*@out@*/struct gps_data_t *gpsdata)
return -2;
}
#ifndef USE_QT
- gpsdata->gps_fd = -1;
+ gpsdata->gps_fd = SHM_PSEUDO_FD;
#else
- gpsdata->gps_fd = (void *)(intptr_t)-1;
+ gpsdata->gps_fd = (void *)(intptr_t)SHM_PSEUDO_FD;
#endif /* USE_QT */
return 0;
}