From e10f92d401f89b610a091623a7005aeeb243e4f9 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Thu, 8 Oct 2020 23:51:55 +0200 Subject: [PATCH] clang-format. --- plocate-build.cpp | 6 ++++-- plocate.cpp | 18 +++++++++++------- turbopfor-encode.h | 1 - 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/plocate-build.cpp b/plocate-build.cpp index c571b09..2af8538 100644 --- a/plocate-build.cpp +++ b/plocate-build.cpp @@ -144,10 +144,12 @@ void PostingListBuilder::write_header(uint32_t docid) class Corpus { public: Corpus(FILE *outfp, size_t block_size) - : invindex(new PostingListBuilder *[NUM_TRIGRAMS]), outfp(outfp), block_size(block_size) { + : invindex(new PostingListBuilder *[NUM_TRIGRAMS]), outfp(outfp), block_size(block_size) + { fill(invindex.get(), invindex.get() + NUM_TRIGRAMS, nullptr); } - ~Corpus() { + ~Corpus() + { for (unsigned i = 0; i < NUM_TRIGRAMS; ++i) { delete invindex[i]; } diff --git a/plocate.cpp b/plocate.cpp index 1ef95bb..508525c 100644 --- a/plocate.cpp +++ b/plocate.cpp @@ -63,7 +63,8 @@ void Serializer::release_current() // See if any delayed prints can now be dealt with. while (!pending.empty() && pending.top().seq == next_seq) { - if (limit_matches-- <= 0) return; + if (limit_matches-- <= 0) + return; for (const string &msg : pending.top().msg) { if (print_nul) { printf("%s%c", msg.c_str(), 0); @@ -197,8 +198,8 @@ size_t Corpus::get_num_filename_blocks() const } uint64_t scan_file_block(const vector &needles, string_view compressed, - unordered_map *access_rx_cache, int seq, - Serializer *serializer) + unordered_map *access_rx_cache, int seq, + Serializer *serializer) { uint64_t matched = 0; @@ -233,9 +234,11 @@ uint64_t scan_file_block(const vector &needles, string_view compressed, } } if (found && has_access(filename, access_rx_cache)) { - if (limit_matches-- <= 0) break; + if (limit_matches-- <= 0) + break; ++matched; - if (only_count) continue; + if (only_count) + continue; if (immediate_print) { if (print_nul) { printf("%s%c", filename, 0); @@ -295,7 +298,8 @@ uint64_t scan_all_docids(const vector &needles, int fd, const Corpus &co size_t relative_offset = offsets[docid] - offsets[io_docid]; size_t len = offsets[docid + 1] - offsets[docid]; matched += scan_file_block(needles, { &compressed[relative_offset], len }, &access_rx_cache, 0, nullptr); - if (limit_matches <= 0) return matched; + if (limit_matches <= 0) + return matched; } } return matched; @@ -394,7 +398,7 @@ void do_search_file(const vector &needles, const char *filename) if (done) break; } - engine.submit_read(fd, len, trgmptr.offset, [trgmptr{trgmptr}, len{len}, &done, &in1, &in2, &out](string_view s) { + engine.submit_read(fd, len, trgmptr.offset, [trgmptr{ trgmptr }, len{ len }, &done, &in1, &in2, &out](string_view s) { if (done) return; uint32_t trgm __attribute__((unused)) = trgmptr.trgm; diff --git a/turbopfor-encode.h b/turbopfor-encode.h index 693bd30..e6e3cd5 100644 --- a/turbopfor-encode.h +++ b/turbopfor-encode.h @@ -14,7 +14,6 @@ #include "turbopfor-common.h" #include - #include #include #include -- 2.39.2