[tracker] libtracker-fts: Clarify code flow
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-fts: Clarify code flow
- Date: Sat, 28 Jan 2017 12:07:50 +0000 (UTC)
commit 7e4078b5cdf1f41f064eb8d7b154f0ed802940b6
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Jan 27 13:25:33 2017 +0100
libtracker-fts: Clarify code flow
The xInst function pointer can't return a <0 column here, so in practical
effects an offsets array is ensured to be created on the first iteration.
It might not seem like that to the keen eye, nor Coverity.
Coverity ID: 1388715
src/libtracker-fts/tracker-fts-tokenizer.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-fts/tracker-fts-tokenizer.c b/src/libtracker-fts/tracker-fts-tokenizer.c
index f6c05ed..44bb762 100644
--- a/src/libtracker-fts/tracker-fts-tokenizer.c
+++ b/src/libtracker-fts/tracker-fts-tokenizer.c
@@ -207,6 +207,7 @@ tracker_offsets_function (const Fts5ExtensionApi *api,
GArray *offsets = NULL;
const gchar * const *property_names;
gint cur_col = -1;
+ gboolean first = TRUE;
if (n_args > 0) {
sqlite3_result_error (ctx, "Invalid argument count", -1);
@@ -228,7 +229,7 @@ tracker_offsets_function (const Fts5ExtensionApi *api,
rc = api->xInst (fts_ctx, i, &phrase, &col, &n_token);
- if (cur_col != col) {
+ if (first || cur_col != col) {
const char *text;
int length;
@@ -242,6 +243,8 @@ tracker_offsets_function (const Fts5ExtensionApi *api,
cur_col = col;
}
+ first = FALSE;
+
if (str->len != 0)
g_string_append_c (str, ',');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]