summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tatarinov <kukabu@gmail.com>2011-09-30 06:47:10 -0400
committerEric S. Raymond <esr@thyrsus.com>2011-09-30 06:47:10 -0400
commit3230c766b2db1550d5c4d7669f11c1a69d75bc86 (patch)
tree2714555cb1f07ee10a6b31ec80b565b5d65b387b
parent88cf39a24114fc9eb27fbfdda20303f5e6d9a0d9 (diff)
downloadgpsd-3230c766b2db1550d5c4d7669f11c1a69d75bc86.tar.gz
Remove duplicate code.
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
-rw-r--r--gpxlogger.c7
-rw-r--r--libgps.h1
-rw-r--r--libgps_core.c4
-rw-r--r--libgps_dbus.c1
-rw-r--r--libgps_shm.c1
-rw-r--r--libgps_sock.c1
6 files changed, 4 insertions, 11 deletions
diff --git a/gpxlogger.c b/gpxlogger.c
index c46df2ff..2576a847 100644
--- a/gpxlogger.c
+++ b/gpxlogger.c
@@ -294,12 +294,6 @@ int main(int argc, char **argv)
source.server, source.port, source.device);
#endif
- /* initializes the gpsdata fields */
- gpsdata.status = STATUS_NO_FIX;
- gpsdata.satellites_used = 0;
- gps_clear_fix(&(gpsdata.fix));
- gps_clear_dop(&(gpsdata.dop));
-
/* catch all interesting signals */
(void)signal(SIGTERM, quit_handler);
(void)signal(SIGQUIT, quit_handler);
@@ -316,7 +310,6 @@ int main(int argc, char **argv)
//syslog (LOG_INFO, "---------- STARTED ----------");
- /* initialize for some export method */
if (gps_open(source.server, source.port, &gpsdata) != 0) {
(void)fprintf(stderr,
"%s: no gpsd running or network error: %d, %s\n",
diff --git a/libgps.h b/libgps.h
index fb26ac2c..5901ea89 100644
--- a/libgps.h
+++ b/libgps.h
@@ -48,5 +48,6 @@ extern int gps_dbus_open(struct gps_data_t *);
extern int gps_dbus_mainloop(struct gps_data_t *, int,
void (*)(struct gps_data_t *));
+#define PRIVATE(gpsdata) ((struct privdata_t *)(gpsdata)->privdata)
#endif /* _GPSD_LIBGPS_H_ */
diff --git a/libgps_core.c b/libgps_core.c
index f8edff46..1759e6a5 100644
--- a/libgps_core.c
+++ b/libgps_core.c
@@ -94,7 +94,9 @@ int gps_open(/*@null@*/const char *host,
gpsdata->set = 0;
gpsdata->status = STATUS_NO_FIX;
- gps_clear_fix(&gpsdata->fix);
+ gpsdata->satellites_used = 0;
+ gps_clear_fix(&(gpsdata->fix));
+ gps_clear_dop(&(gpsdata->dop));
return status;
/*@ +branchstate +compdef @*/
diff --git a/libgps_dbus.c b/libgps_dbus.c
index 79bddced..4a6e2f71 100644
--- a/libgps_dbus.c
+++ b/libgps_dbus.c
@@ -22,7 +22,6 @@ struct privdata_t
{
void (*handler)(struct gps_data_t *);
};
-#define PRIVATE(gpsdata) ((struct privdata_t *)(gpsdata)->privdata)
#include <glib.h>
#include <dbus/dbus.h>
diff --git a/libgps_shm.c b/libgps_shm.c
index 4ba4d309..b28b13a7 100644
--- a/libgps_shm.c
+++ b/libgps_shm.c
@@ -33,7 +33,6 @@ struct privdata_t
void *shmseg;
};
/*@+matchfields@*/
-#define PRIVATE(gpsdata) ((struct privdata_t *)(gpsdata)->privdata)
int gps_shm_open(/*@out@*/struct gps_data_t *gpsdata)
diff --git a/libgps_sock.c b/libgps_sock.c
index 7a34a75b..04796850 100644
--- a/libgps_sock.c
+++ b/libgps_sock.c
@@ -51,7 +51,6 @@ struct privdata_t
#endif /* LIBGPS_DEBUG */
};
/*@+matchfields@*/
-#define PRIVATE(gpsdata) ((struct privdata_t *)gpsdata->privdata)
/*@-branchstate@*/
int gps_sock_open(/*@null@*/const char *host, /*@null@*/const char *port,