]> git.sesse.net Git - remoteglot-book/commitdiff
(Sort of) fix a hang.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Dec 2014 17:09:56 +0000 (18:09 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Dec 2014 17:09:56 +0000 (18:09 +0100)
binlookup.cpp

index afc446c73a7749ef49a9838f3cc17f1d1b1d93b9..08455ebd0850769cb0c9440f2bbe19cc52bfee90 100644 (file)
@@ -58,7 +58,7 @@ int main(int argc, char **argv)
                const uint8_t *key, *val;
                size_t len_key, len_val;
 
-               while (mtbl_iter_next(it, &key, &len_key, &val, &len_val)) {
+               if (mtbl_iter_next(it, &key, &len_key, &val, &len_val)) {
                        Count c;
                        c.ParseFromArray(val, len_val);
                        printf("%d %d %d %u %f %f %d %ld %d %ld",
@@ -72,6 +72,8 @@ int main(int argc, char **argv)
                                printf(" %s", c.move(j).c_str());
                        }
                        printf("\n");
+               } else {
+                       printf("-\n");
                }
                fflush(stdout);
                mtbl_iter_destroy(&it);