summaryrefslogtreecommitdiff
path: root/packet.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-10-17 04:50:21 -0400
committerEric S. Raymond <esr@thyrsus.com>2013-10-17 04:50:47 -0400
commit96621804887d8f800e535dbbaa6e85a482803fee (patch)
tree2d3d214e603cbd044118b8002c743ec4be1563b5 /packet.c
parent619cacaf081c5c50059316ed5902c8ed18aef15d (diff)
downloadgpsd-96621804887d8f800e535dbbaa6e85a482803fee.tar.gz
Narrow a variable scope. All regression tests pass.
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/packet.c b/packet.c
index bdbec125..ce600627 100644
--- a/packet.c
+++ b/packet.c
@@ -1356,20 +1356,21 @@ static void packet_accept(struct gps_packet_t *lexer, int packet_type)
/* packet grab succeeded, move to output buffer */
{
size_t packetlen = lexer->inbufptr - lexer->inbuffer;
- char scratchbuf[MAX_PACKET_LENGTH*2+1];
if (packetlen < sizeof(lexer->outbuffer)) {
memcpy(lexer->outbuffer, lexer->inbuffer, packetlen);
lexer->outbuflen = packetlen;
lexer->outbuffer[packetlen] = '\0';
lexer->type = packet_type;
- if (lexer->debug >= LOG_RAW+1)
+ if (lexer->debug >= LOG_RAW+1) {
+ char scratchbuf[MAX_PACKET_LENGTH*2+1];
gpsd_report(lexer->debug, LOG_RAW+1,
"Packet type %d accepted %zu = %s\n",
packet_type, packetlen,
gpsd_packetdump(scratchbuf, sizeof(scratchbuf),
(char *)lexer->outbuffer,
lexer->outbuflen));
+ }
} else {
gpsd_report(lexer->debug, LOG_ERROR,
"Rejected too long packet type %d len %zu\n",