diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-10-17 04:50:21 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-10-17 04:50:47 -0400 |
commit | 96621804887d8f800e535dbbaa6e85a482803fee (patch) | |
tree | 2d3d214e603cbd044118b8002c743ec4be1563b5 /packet.c | |
parent | 619cacaf081c5c50059316ed5902c8ed18aef15d (diff) | |
download | gpsd-96621804887d8f800e535dbbaa6e85a482803fee.tar.gz |
Narrow a variable scope. All regression tests pass.
Diffstat (limited to 'packet.c')
-rw-r--r-- | packet.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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", |