diff options
author | Marco Bubke <marco.bubke@qt.io> | 2017-09-21 11:43:59 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@qt.io> | 2017-10-05 17:36:37 +0000 |
commit | d2e15e5f1efa1ef160a2d4f40ab61180477d1f14 (patch) | |
tree | b35eeec94b895a48e9c7ce6ea00c245935d1ea38 /src/libs/utils/smallstringview.h | |
parent | 0be824000262882023b2b48b5eab0786f3db379b (diff) |
Clang: Add file cache
The database is using file path integer ids to handle file paths because
otherwise we would save many redundant data. This patch is improving it
further with the introduction of a database based file path cache. The
entries are now divided in a directory path and file name. This is quite
handy for directory based file watching.
Change-Id: I03f2e388e43f3d521d6bf8e39dfb95eb2309dc73
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src/libs/utils/smallstringview.h')
-rw-r--r-- | src/libs/utils/smallstringview.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libs/utils/smallstringview.h b/src/libs/utils/smallstringview.h index 3d479195f17..39cb86b193c 100644 --- a/src/libs/utils/smallstringview.h +++ b/src/libs/utils/smallstringview.h @@ -193,15 +193,16 @@ inline int reverse_memcmp(const char *first, const char *second, size_t n) { - const char *currentFirst = first + n; - const char *currentSecond = second + n; + const char *currentFirst = first + n - 1; + const char *currentSecond = second + n - 1; while (n > 0) { // If the current characters differ, return an appropriately signed // value; otherwise, keep searching backwards - if (*currentFirst != *currentSecond) - return *currentFirst - *currentSecond; + int difference = *currentFirst - *currentSecond; + if (difference != 0) + return difference; --currentFirst; --currentSecond; |