[tracker] Refactor tracker-parser to be located in libtracker-common



commit 5d05f68da10ef5a2c25fba4246120ce525035d51
Author: Philip Van Hoof <philip codeminded be>
Date:   Mon Dec 1 14:07:16 2014 +0100

    Refactor tracker-parser to be located in libtracker-common
    
    This also fixes the unaccenting SPARQL function in case of --disable-tracker-fts

 configure.ac                                       |    4 ++++
 src/libtracker-common/Makefile.am                  |   19 ++++++++++++++-----
 .../tracker-parser-libicu.c                        |    0
 .../tracker-parser-libunistring.c                  |    0
 .../tracker-parser-utils.c                         |    0
 .../tracker-parser-utils.h                         |    0
 .../tracker-parser.h                               |    0
 src/libtracker-data/tracker-db-interface-sqlite.c  |    7 ++-----
 src/libtracker-fts/Makefile.am                     |   13 +------------
 src/libtracker-fts/tracker-fts-tokenizer.c         |    3 ++-
 10 files changed, 23 insertions(+), 23 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d2a0b58..aa37dc9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1049,6 +1049,10 @@ esac
 
 AM_CONDITIONAL(HAVE_LIBICU, test "x$have_libicu" = "xyes")
 
+# Add to libtracker-common
+LIBTRACKER_COMMON_CFLAGS="$LIBTRACKER_COMMON_CFLAGS $UNICODE_SUPPORT_CFLAGS"
+LIBTRACKER_COMMON_LIBS="$LIBTRACKER_COMMON_LIBS $UNICODE_SUPPORT_LIBS"
+
 # Add to libtracker-fts
 LIBTRACKER_FTS_CFLAGS="$LIBTRACKER_FTS_CFLAGS $UNICODE_SUPPORT_CFLAGS"
 LIBTRACKER_FTS_LIBS="$LIBTRACKER_FTS_LIBS $UNICODE_SUPPORT_LIBS"
diff --git a/src/libtracker-common/Makefile.am b/src/libtracker-common/Makefile.am
index adbcf78..9c3b4e2 100644
--- a/src/libtracker-common/Makefile.am
+++ b/src/libtracker-common/Makefile.am
@@ -19,7 +19,9 @@ libtracker_common_la_SOURCES = \
        tracker-sched.c \
        tracker-type-utils.c \
        tracker-utils.c \
-       tracker-locale.c
+       tracker-locale.c \
+       tracker-parser-utils.c \
+       tracker-language.c
 
 noinst_HEADERS = \
        tracker-dbus.h \
@@ -32,11 +34,18 @@ noinst_HEADERS = \
        tracker-sched.h \
        tracker-type-utils.h \
        tracker-utils.h \
-       tracker-locale.h
+       tracker-locale.h \
+       tracker-parser.h \
+       tracker-parser-utils.h \
+       tracker-language.h
 
-if HAVE_TRACKER_FTS
-libtracker_common_la_SOURCES += tracker-language.c
-noinst_HEADERS += tracker-language.h
+
+if BUILD_LIBUNISTRING_PARSER
+  libtracker_common_la_SOURCES += tracker-parser-libunistring.c
+endif
+
+if BUILD_LIBICU_PARSER
+  libtracker_common_la_SOURCES += tracker-parser-libicu.c
 endif
 
 libtracker_common_la_LIBADD = \
diff --git a/src/libtracker-fts/tracker-parser-libicu.c b/src/libtracker-common/tracker-parser-libicu.c
similarity index 100%
rename from src/libtracker-fts/tracker-parser-libicu.c
rename to src/libtracker-common/tracker-parser-libicu.c
diff --git a/src/libtracker-fts/tracker-parser-libunistring.c 
b/src/libtracker-common/tracker-parser-libunistring.c
similarity index 100%
rename from src/libtracker-fts/tracker-parser-libunistring.c
rename to src/libtracker-common/tracker-parser-libunistring.c
diff --git a/src/libtracker-fts/tracker-parser-utils.c b/src/libtracker-common/tracker-parser-utils.c
similarity index 100%
rename from src/libtracker-fts/tracker-parser-utils.c
rename to src/libtracker-common/tracker-parser-utils.c
diff --git a/src/libtracker-fts/tracker-parser-utils.h b/src/libtracker-common/tracker-parser-utils.h
similarity index 100%
rename from src/libtracker-fts/tracker-parser-utils.h
rename to src/libtracker-common/tracker-parser-utils.h
diff --git a/src/libtracker-fts/tracker-parser.h b/src/libtracker-common/tracker-parser.h
similarity index 100%
rename from src/libtracker-fts/tracker-parser.h
rename to src/libtracker-common/tracker-parser.h
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c 
b/src/libtracker-data/tracker-db-interface-sqlite.c
index 56d4695..3490c42 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -28,14 +28,15 @@
 
 #include <libtracker-common/tracker-date-time.h>
 #include <libtracker-common/tracker-locale.h>
+#include <libtracker-common/tracker-parser.h>
 
 #include <libtracker-sparql/tracker-sparql.h>
 
 #if HAVE_TRACKER_FTS
 #include <libtracker-fts/tracker-fts.h>
-#include <libtracker-fts/tracker-parser.h>
 #endif
 
+
 #ifdef HAVE_LIBUNISTRING
 /* libunistring versions prior to 9.1.2 need this hack */
 #define _UNUSED_PARAMETER_
@@ -682,10 +683,8 @@ function_sparql_unaccent (sqlite3_context *context,
 
        zOutput = u8_normalize (UNINORM_NFKD, zInput, nInput, NULL, &written);
 
-#if HAVE_TRACKER_FTS
        /* Unaccenting is done in place */
        tracker_parser_unaccent_nfkd_string (zOutput, &written);
-#endif
 
        sqlite3_result_text (context, zOutput, written, free);
 }
@@ -875,10 +874,8 @@ function_sparql_unaccent (sqlite3_context *context,
                return;
        }
 
-#if HAVE_TRACKER_FTS
        /* Unaccenting is done in place */
        tracker_parser_unaccent_nfkd_string (zOutput, &nOutput);
-#endif
 
        sqlite3_result_text16 (context, zOutput, -1, sqlite3_free);
 }
diff --git a/src/libtracker-fts/Makefile.am b/src/libtracker-fts/Makefile.am
index e583c39..86b7ac3 100644
--- a/src/libtracker-fts/Makefile.am
+++ b/src/libtracker-fts/Makefile.am
@@ -33,23 +33,12 @@ libtracker_fts_la_SOURCES =                            \
        tracker-fts-config.c                           \
        tracker-fts-config.h                           \
        tracker-fts-tokenizer.c                        \
-       tracker-fts-tokenizer.h                        \
-       tracker-parser-utils.c                         \
-       tracker-parser-utils.h                         \
-       tracker-parser.h
+       tracker-fts-tokenizer.h
 
 if !HAVE_BUILTIN_FTS
   libtracker_fts_la_SOURCES += $(fts4_sources)
 endif
 
-if BUILD_LIBUNISTRING_PARSER
-  libtracker_fts_la_SOURCES += tracker-parser-libunistring.c
-endif
-
-if BUILD_LIBICU_PARSER
-  libtracker_fts_la_SOURCES += tracker-parser-libicu.c
-endif
-
 libtracker_fts_la_LIBADD =                             \
        $(top_builddir)/src/libtracker-common/libtracker-common.la \
        $(BUILD_LIBS)                                  \
diff --git a/src/libtracker-fts/tracker-fts-tokenizer.c b/src/libtracker-fts/tracker-fts-tokenizer.c
index d61ae79..c45d73d 100644
--- a/src/libtracker-fts/tracker-fts-tokenizer.c
+++ b/src/libtracker-fts/tracker-fts-tokenizer.c
@@ -26,9 +26,10 @@
 #include <assert.h>
 #include <string.h>
 
+#include <libtracker-common/tracker-parser.h>
+
 #include "tracker-fts-tokenizer.h"
 #include "tracker-fts-config.h"
-#include "tracker-parser.h"
 #include "fts3_tokenizer.h"
 
 typedef struct TrackerTokenizer TrackerTokenizer;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]