]> git.sesse.net Git - plocate/commitdiff
clang-format.
authorSteinar H. Gunderson <steinar+git@gunderson.no>
Thu, 8 Oct 2020 21:51:55 +0000 (23:51 +0200)
committerSteinar H. Gunderson <steinar+git@gunderson.no>
Thu, 8 Oct 2020 21:51:55 +0000 (23:51 +0200)
plocate-build.cpp
plocate.cpp
turbopfor-encode.h

index c571b0981b32bfb89328320114a5e61f5f52c100..2af85385aa0d80209626b773ff80a2c7651dbdc7 100644 (file)
@@ -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];
                }
index 1ef95bbbd41e8c648a1a1cd7994c84b588f8cae1..508525c475befb644738ef519c83cfc31ac84c0c 100644 (file)
@@ -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<string> &needles, string_view compressed,
-                       unordered_map<string, bool> *access_rx_cache, int seq,
-                       Serializer *serializer)
+                         unordered_map<string, bool> *access_rx_cache, int seq,
+                         Serializer *serializer)
 {
        uint64_t matched = 0;
 
@@ -233,9 +234,11 @@ uint64_t scan_file_block(const vector<string> &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<string> &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<string> &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;
index 693bd301544a9cdcec378b2dd5bc5c2e7547ae17..e6e3cd5f13129767fef24bda95420b5cf1be9c35 100644 (file)
@@ -14,7 +14,6 @@
 #include "turbopfor-common.h"
 
 #include <algorithm>
-
 #include <assert.h>
 #include <limits.h>
 #include <stdint.h>