diff options
author | Gary E. Miller <gem@rellim.com> | 2016-09-01 12:45:09 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2016-09-01 12:45:09 -0700 |
commit | 902b4618f20607e7bc78fd29071118f315eef23d (patch) | |
tree | ffde5c1aa851907b53c23b2a927b96911971a422 /hex.c | |
parent | 8f74020d331f0aa1fd165f2d9490fc66022745c2 (diff) | |
download | gpsd-902b4618f20607e7bc78fd29071118f315eef23d.tar.gz |
No need to iterate a whole buffer when we know the answer.
Diffstat (limited to 'hex.c')
-rw-r--r-- | hex.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -30,8 +30,10 @@ const char *gpsd_packetdump(char *scbuf, size_t scbuflen, assert(binbuf != NULL); for (cp = binbuf; cp < binbuf + binbuflen; cp++) - if (!isprint((unsigned char) *cp) && !isspace((unsigned char) *cp)) + if (!isprint((unsigned char) *cp) && !isspace((unsigned char) *cp)) { printable = false; + break; /* no need to keep iterating */ + } if (printable) return binbuf; else |