summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2014-08-27 10:13:33 -0400
committerEric S. Raymond <esr@thyrsus.com>2014-08-27 10:13:33 -0400
commitb53db1322c70f8b86dfe72e982d6097304a749ae (patch)
treea0fb8ee832996aa43a0cdfc8857f65ec299e249c
parente897f0486257632728cdea0076bafc9dd1ede09a (diff)
downloadgpsd-b53db1322c70f8b86dfe72e982d6097304a749ae.tar.gz
Eliminate gpsd_report() from isgps.c. All regression tests pass.
-rw-r--r--gpsd.h-tail2
-rw-r--r--isgps.c22
-rw-r--r--packet.c2
3 files changed, 14 insertions, 12 deletions
diff --git a/gpsd.h-tail b/gpsd.h-tail
index 21f60c79..970865ea 100644
--- a/gpsd.h-tail
+++ b/gpsd.h-tail
@@ -209,6 +209,8 @@ struct gps_lexer_t {
};
extern void lexer_init(/*@out@*/struct gps_lexer_t *);
+extern void lexer_report(const struct gps_lexer_t *,
+ const int, const char *, ...);
extern void packet_reset(/*@out@*/struct gps_lexer_t *);
extern void packet_pushback(struct gps_lexer_t *);
extern void packet_parse(struct gps_lexer_t *);
diff --git a/isgps.c b/isgps.c
index 66b5e8af..24ce50b6 100644
--- a/isgps.c
+++ b/isgps.c
@@ -186,7 +186,7 @@ enum isgpsstat_t isgps_decode(struct gps_lexer_t *lexer,
{
/* ASCII characters 64-127, @ through DEL */
if ((c & MAG_TAG_MASK) != MAG_TAG_DATA) {
- gpsd_report(lexer->debug, ISGPS_ERRLEVEL_BASE + 1,
+ lexer_report(lexer, ISGPS_ERRLEVEL_BASE + 1,
"ISGPS word tag not correct, skipping byte\n");
return ISGPS_SKIP;
}
@@ -206,18 +206,18 @@ enum isgpsstat_t isgps_decode(struct gps_lexer_t *lexer,
lexer->isgps.curr_word |=
c >> -(lexer->isgps.curr_offset);
}
- gpsd_report(lexer->debug, ISGPS_ERRLEVEL_BASE + 2,
+ lexer_report(lexer, ISGPS_ERRLEVEL_BASE + 2,
"ISGPS syncing at byte %lu: 0x%08x\n",
lexer->char_counter, lexer->isgps.curr_word);
if (preamble_match(&lexer->isgps.curr_word)) {
if (isgps_parityok(lexer->isgps.curr_word)) {
- gpsd_report(lexer->debug, ISGPS_ERRLEVEL_BASE + 1,
+ lexer_report(lexer, ISGPS_ERRLEVEL_BASE + 1,
"ISGPS preamble ok, parity ok -- locked\n");
lexer->isgps.locked = true;
break;
}
- gpsd_report(lexer->debug, ISGPS_ERRLEVEL_BASE + 1,
+ lexer_report(lexer, ISGPS_ERRLEVEL_BASE + 1,
"ISGPS preamble ok, parity fail\n");
}
lexer->isgps.curr_offset++;
@@ -246,13 +246,13 @@ enum isgpsstat_t isgps_decode(struct gps_lexer_t *lexer,
* another preamble pattern in the data stream. -wsr
*/
if (preamble_match(&lexer->isgps.curr_word)) {
- gpsd_report(lexer->debug, ISGPS_ERRLEVEL_BASE + 2,
+ lexer_report(lexer, ISGPS_ERRLEVEL_BASE + 2,
"ISGPS preamble spotted (index: %u)\n",
lexer->isgps.bufindex);
lexer->isgps.bufindex = 0;
}
#endif
- gpsd_report(lexer->debug, ISGPS_ERRLEVEL_BASE + 2,
+ lexer_report(lexer, ISGPS_ERRLEVEL_BASE + 2,
"ISGPS processing word %u (offset %d)\n",
lexer->isgps.bufindex,
lexer->isgps.curr_offset);
@@ -263,7 +263,7 @@ enum isgpsstat_t isgps_decode(struct gps_lexer_t *lexer,
*/
if (lexer->isgps.bufindex >= (unsigned)maxlen) {
lexer->isgps.bufindex = 0;
- gpsd_report(lexer->debug, ISGPS_ERRLEVEL_BASE + 1,
+ lexer_report(lexer, ISGPS_ERRLEVEL_BASE + 1,
"ISGPS buffer overflowing -- resetting\n");
return ISGPS_NO_SYNC;
}
@@ -274,7 +274,7 @@ enum isgpsstat_t isgps_decode(struct gps_lexer_t *lexer,
/* *INDENT-OFF* */
if ((lexer->isgps.bufindex == 0) &&
!preamble_match((isgps30bits_t *) lexer->isgps.buf)) {
- gpsd_report(lexer->debug, ISGPS_ERRLEVEL_BASE + 1,
+ lexer_report(lexer, ISGPS_ERRLEVEL_BASE + 1,
"ISGPS word 0 not a preamble- punting\n");
return ISGPS_NO_SYNC;
}
@@ -298,13 +298,13 @@ enum isgpsstat_t isgps_decode(struct gps_lexer_t *lexer,
c >> -(lexer->isgps.curr_offset);
}
} else {
- gpsd_report(lexer->debug, ISGPS_ERRLEVEL_BASE + 0,
+ lexer_report(lexer, ISGPS_ERRLEVEL_BASE + 0,
"ISGPS parity failure, lost lock\n");
lexer->isgps.locked = false;
}
}
lexer->isgps.curr_offset -= 6;
- gpsd_report(lexer->debug, ISGPS_ERRLEVEL_BASE + 2,
+ lexer_report(lexer, ISGPS_ERRLEVEL_BASE + 2,
"ISGPS residual %d\n",
lexer->isgps.curr_offset);
return res;
@@ -312,7 +312,7 @@ enum isgpsstat_t isgps_decode(struct gps_lexer_t *lexer,
/*@ +shiftnegative @*/
/* never achieved lock */
- gpsd_report(lexer->debug, ISGPS_ERRLEVEL_BASE + 1,
+ lexer_report(lexer, ISGPS_ERRLEVEL_BASE + 1,
"ISGPS lock never achieved\n");
return ISGPS_NO_SYNC;
}
diff --git a/packet.c b/packet.c
index 36d67664..c8b4d69f 100644
--- a/packet.c
+++ b/packet.c
@@ -119,7 +119,7 @@ enum
#include "packet_states.h"
};
-static void lexer_report(const struct gps_lexer_t *lexer,
+void lexer_report(const struct gps_lexer_t *lexer,
const int errlevel,
const char *fmt, ...)
{