summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hex.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hex.c b/hex.c
index 4d03a698..e03ddc97 100644
--- a/hex.c
+++ b/hex.c
@@ -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