diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2023-03-02 09:45:22 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2023-03-02 09:45:22 +0100 |
commit | 6d250002586146de5ff1d34eaa29440bc18ff3ae (patch) | |
tree | 582cd3afb5151ab07a2c12ab990dbd4e57795b5f /src | |
parent | d2083119e57afa1f088026dfcaa8617add99b49e (diff) | |
download | tracker-6d250002586146de5ff1d34eaa29440bc18ff3ae.tar.gz |
core: Move function out of ifdef
This function is only defined if the libicu-based text parser
is enabled, but does not belong there. Move it out, and fix
build when enabling libunistring for unicode management.
Diffstat (limited to 'src')
-rw-r--r-- | src/libtracker-sparql/core/tracker-db-interface-sqlite.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/libtracker-sparql/core/tracker-db-interface-sqlite.c b/src/libtracker-sparql/core/tracker-db-interface-sqlite.c index 6ec1c1194..36f4fdcc9 100644 --- a/src/libtracker-sparql/core/tracker-db-interface-sqlite.c +++ b/src/libtracker-sparql/core/tracker-db-interface-sqlite.c @@ -1252,31 +1252,6 @@ function_sparql_case_fold (sqlite3_context *context, sqlite3_result_text16 (context, zOutput, -1, sqlite3_free); } -static void -function_sparql_strip_punctuation (sqlite3_context *context, - int argc, - sqlite3_value *argv[]) -{ - const gchar *fn = "tracker:strip-punctuation"; - gchar *input, *replacement = "", *output = NULL; - GError *error = NULL; - GRegex *regex; - input = (gchar *)sqlite3_value_text (argv[0]); - const gchar *pattern = "\\p{P}"; - - regex = g_regex_new (pattern, 0, 0, &error); - if (error) - { - result_context_function_error (context, fn, error->message); - g_clear_error (&error); - return; - } - - output = g_regex_replace (regex, input, -1, 0, replacement, 0, &error); - - sqlite3_result_text (context, output, -1, g_free); -} - static gunichar2 * normalize_string (const gunichar2 *string, gsize string_len, /* In gunichar2s */ @@ -1413,6 +1388,31 @@ function_sparql_unaccent (sqlite3_context *context, #endif static void +function_sparql_strip_punctuation (sqlite3_context *context, + int argc, + sqlite3_value *argv[]) +{ + const gchar *fn = "tracker:strip-punctuation"; + gchar *input, *replacement = "", *output = NULL; + GError *error = NULL; + GRegex *regex; + input = (gchar *)sqlite3_value_text (argv[0]); + const gchar *pattern = "\\p{P}"; + + regex = g_regex_new (pattern, 0, 0, &error); + if (error) + { + result_context_function_error (context, fn, error->message); + g_clear_error (&error); + return; + } + + output = g_regex_replace (regex, input, -1, 0, replacement, 0, &error); + + sqlite3_result_text (context, output, -1, g_free); +} + +static void function_sparql_encode_for_uri (sqlite3_context *context, int argc, sqlite3_value *argv[]) |