summaryrefslogtreecommitdiff
path: root/driver_zodiac.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-03-18 21:19:00 -0400
committerEric S. Raymond <esr@thyrsus.com>2015-03-18 21:19:00 -0400
commit06ade1b80bf1835b4f83bedd5d2c3c85d6d870ac (patch)
tree892a5886959c312be37829eb1d7e38f07df0eba9 /driver_zodiac.c
parenta790e8647ace4eca87f26b9ded555b708909596a (diff)
downloadgpsd-06ade1b80bf1835b4f83bedd5d2c3c85d6d870ac.tar.gz
Minor efficiency improvement.
Diffstat (limited to 'driver_zodiac.c')
-rw-r--r--driver_zodiac.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/driver_zodiac.c b/driver_zodiac.c
index d3fe0b7e..76f8d3f8 100644
--- a/driver_zodiac.c
+++ b/driver_zodiac.c
@@ -353,9 +353,15 @@ static gps_mask_t zodiac_analyze(struct gps_device_t *session)
unsigned int id =
(unsigned int)((session->lexer.outbuffer[3] << 8) |
session->lexer.outbuffer[2]);
- gpsd_log(&session->context->errout, LOG_RAW,
- "Raw Zodiac packet type %d length %zd: %s\n",
- id, session->lexer.outbuflen, gpsd_prettydump(session));
+ /*
+ * The guard looks superfluous, but it keeps the rather expensive
+ * gpsd_packetdump() function from being called even when the debug
+ * level does not actually require it.
+ */
+ if (session->context->errout.debug >= LOG_RAW)
+ gpsd_log(&session->context->errout, LOG_RAW,
+ "Raw Zodiac packet type %d length %zd: %s\n",
+ id, session->lexer.outbuflen, gpsd_prettydump(session));
if (session->lexer.outbuflen < 10)
return 0;