tracker r2537 - in trunk: . src/libtracker-common src/libtracker-data src/libtracker-db src/tracker-indexer src/trackerd
- From: carlosg svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2537 - in trunk: . src/libtracker-common src/libtracker-data src/libtracker-db src/tracker-indexer src/trackerd
- Date: Thu, 20 Nov 2008 16:15:59 +0000 (UTC)
Author: carlosg
Date: Thu Nov 20 16:15:59 2008
New Revision: 2537
URL: http://svn.gnome.org/viewvc/tracker?rev=2537&view=rev
Log:
2008-11-20 Carlos Garnacho <carlos imendio com>
* src/libtracker-common/tracker-ontology.[ch]
(tracker_ontology_get_service_by_id)
(tracker_ontology_get_service_by_mime):
* src/libtracker-data/tracker-data-query.[ch]
(tracker_data_query_service_type_by_id): Make them return const
gchar*, since the strings are stored in the ontology and guaranteed to
be there until it shuts down.
* src/libtracker-db/tracker-db-index-manager.c
(tracker_db_index_manager_get_index_by_service_id):
* src/libtracker-db/tracker-db-manager.c (function_get_service_name):
* src/tracker-indexer/tracker-indexer.c (item_remove):
* src/tracker-indexer/tracker-metadata-utils.c
(metadata_utils_get_embedded) (tracker_metadata_utils_get_text):
* src/trackerd/tracker-files.c (tracker_files_get_service_type):
* src/trackerd/tracker-metadata.c (tracker_metadata_get):
* src/trackerd/tracker-search.c (tracker_search_get_hit_count_all):
Adapt to API change.
Modified:
trunk/ChangeLog
trunk/src/libtracker-common/tracker-ontology.c
trunk/src/libtracker-common/tracker-ontology.h
trunk/src/libtracker-data/tracker-data-query.c
trunk/src/libtracker-data/tracker-data-query.h
trunk/src/libtracker-db/tracker-db-index-manager.c
trunk/src/libtracker-db/tracker-db-manager.c
trunk/src/tracker-indexer/tracker-indexer.c
trunk/src/tracker-indexer/tracker-metadata-utils.c
trunk/src/trackerd/tracker-files.c
trunk/src/trackerd/tracker-metadata.c
trunk/src/trackerd/tracker-search.c
Modified: trunk/src/libtracker-common/tracker-ontology.c
==============================================================================
--- trunk/src/libtracker-common/tracker-ontology.c (original)
+++ trunk/src/libtracker-common/tracker-ontology.c Thu Nov 20 16:15:59 2008
@@ -246,7 +246,7 @@
return g_hash_table_lookup (service_names, service_str);
}
-gchar *
+G_CONST_RETURN gchar *
tracker_ontology_get_service_by_id (gint id)
{
TrackerService *service;
@@ -257,10 +257,10 @@
return NULL;
}
- return g_strdup (tracker_service_get_name (service));
+ return tracker_service_get_name (service);
}
-gchar *
+G_CONST_RETURN gchar *
tracker_ontology_get_service_by_mime (const gchar *mime)
{
gpointer id;
Modified: trunk/src/libtracker-common/tracker-ontology.h
==============================================================================
--- trunk/src/libtracker-common/tracker-ontology.h (original)
+++ trunk/src/libtracker-common/tracker-ontology.h Thu Nov 20 16:15:59 2008
@@ -41,8 +41,10 @@
GSList *mimes,
GSList *mime_prefixes);
TrackerService *tracker_ontology_get_service_by_name (const gchar *service_str);
-gchar * tracker_ontology_get_service_by_id (gint id);
-gchar * tracker_ontology_get_service_by_mime (const gchar *mime);
+G_CONST_RETURN gchar *
+ tracker_ontology_get_service_by_id (gint id);
+G_CONST_RETURN gchar *
+ tracker_ontology_get_service_by_mime (const gchar *mime);
gint tracker_ontology_get_service_id_by_name (const gchar *service_str);
TrackerDBType tracker_ontology_get_service_db_by_name (const gchar *service_str);
gchar * tracker_ontology_get_service_parent (const gchar *service_str);
Modified: trunk/src/libtracker-data/tracker-data-query.c
==============================================================================
--- trunk/src/libtracker-data/tracker-data-query.c (original)
+++ trunk/src/libtracker-data/tracker-data-query.c Thu Nov 20 16:15:59 2008
@@ -227,13 +227,13 @@
/*
* Obtain the concrete service type name for the file id.
*/
-gchar *
+G_CONST_RETURN gchar *
tracker_data_query_service_type_by_id (TrackerDBInterface *iface,
const gchar *service_id)
{
TrackerDBResultSet *result_set;
gint service_type_id;
- gchar *result = NULL;
+ const gchar *result = NULL;
g_return_val_if_fail (TRACKER_IS_DB_INTERFACE (iface), NULL);
g_return_val_if_fail (service_id != NULL, NULL);
Modified: trunk/src/libtracker-data/tracker-data-query.h
==============================================================================
--- trunk/src/libtracker-data/tracker-data-query.h (original)
+++ trunk/src/libtracker-data/tracker-data-query.h Thu Nov 20 16:15:59 2008
@@ -72,7 +72,8 @@
const gchar *basename);
/* Service API */
-gchar * tracker_data_query_service_type_by_id (TrackerDBInterface *iface,
+G_CONST_RETURN gchar *
+ tracker_data_query_service_type_by_id (TrackerDBInterface *iface,
const gchar *service_id);
/* Files API */
Modified: trunk/src/libtracker-db/tracker-db-index-manager.c
==============================================================================
--- trunk/src/libtracker-db/tracker-db-index-manager.c (original)
+++ trunk/src/libtracker-db/tracker-db-index-manager.c Thu Nov 20 16:15:59 2008
@@ -304,7 +304,7 @@
{
TrackerDBType type;
TrackerDBIndexType index_type;
- gchar *service;
+ const gchar *service;
g_return_val_if_fail (initialized == TRUE, NULL);
@@ -314,7 +314,6 @@
}
type = tracker_ontology_get_service_db_by_name (service);
- g_free (service);
switch (type) {
case TRACKER_DB_TYPE_FILES:
Modified: trunk/src/libtracker-db/tracker-db-manager.c
==============================================================================
--- trunk/src/libtracker-db/tracker-db-manager.c (original)
+++ trunk/src/libtracker-db/tracker-db-manager.c Thu Nov 20 16:15:59 2008
@@ -1287,11 +1287,11 @@
GValue values[])
{
GValue result = { 0, };
- gchar *str;
+ const gchar *str;
str = tracker_ontology_get_service_by_id (g_value_get_int (&values[0]));
g_value_init (&result, G_TYPE_STRING);
- g_value_take_string (&result, str);
+ g_value_set_string (&result, str);
return result;
}
Modified: trunk/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- trunk/src/tracker-indexer/tracker-indexer.c (original)
+++ trunk/src/tracker-indexer/tracker-indexer.c Thu Nov 20 16:15:59 2008
@@ -1536,7 +1536,7 @@
basename);
if (!service_type || !service_type[0]) {
- gchar *name;
+ const gchar *name;
/* The file is not anymore in the filesystem. Obtain
* the service type from the DB.
@@ -1550,7 +1550,6 @@
name = tracker_ontology_get_service_by_id (service_type_id);
service = tracker_ontology_get_service_by_name (name);
- g_free (name);
} else {
service = tracker_ontology_get_service_by_name (service_type);
service_type_id = tracker_service_get_id (service);
Modified: trunk/src/tracker-indexer/tracker-metadata-utils.c
==============================================================================
--- trunk/src/tracker-indexer/tracker-metadata-utils.c (original)
+++ trunk/src/tracker-indexer/tracker-metadata-utils.c Thu Nov 20 16:15:59 2008
@@ -318,8 +318,8 @@
TrackerDataMetadata *metadata)
{
gchar **values;
- gchar *service_type;
- gint i;
+ const gchar *service_type;
+ gint i;
service_type = tracker_ontology_get_service_by_mime (mime_type);
if (!service_type) {
@@ -327,12 +327,9 @@
}
if (!tracker_ontology_service_has_metadata (service_type)) {
- g_free (service_type);
return;
}
- g_free (service_type);
-
values = metadata_query_file (path, mime_type);
if (!values) {
@@ -884,7 +881,8 @@
gchar *
tracker_metadata_utils_get_text (GFile *file)
{
- gchar *path, *mime_type, *service_type, *text;
+ const gchar *service_type;
+ gchar *path, *mime_type, *text;
path = g_file_get_path (file);
@@ -900,7 +898,6 @@
text = get_file_content_by_filter (path, mime_type);
}
- g_free (service_type);
g_free (mime_type);
g_free (path);
Modified: trunk/src/trackerd/tracker-files.c
==============================================================================
--- trunk/src/trackerd/tracker-files.c (original)
+++ trunk/src/trackerd/tracker-files.c Thu Nov 20 16:15:59 2008
@@ -259,7 +259,7 @@
guint request_id;
gint file_id;
gchar *file_id_str;
- gchar *value = NULL;
+ const gchar *value;
const gchar *service_type;
const gchar *mime = NULL;
GError *actual_error = NULL;
@@ -323,7 +323,6 @@
mime,
value);
dbus_g_method_return (context, value);
- g_free (value);
tracker_dbus_request_success (request_id);
} else {
Modified: trunk/src/trackerd/tracker-metadata.c
==============================================================================
--- trunk/src/trackerd/tracker-metadata.c (original)
+++ trunk/src/trackerd/tracker-metadata.c Thu Nov 20 16:15:59 2008
@@ -77,7 +77,8 @@
TrackerDBInterface *iface;
TrackerDBResultSet *result_set;
guint request_id;
- gchar *service_id, *service_result;
+ const gchar *service_result;
+ gchar *service_id;
guint i;
gchar **values;
GError *actual_error = NULL;
@@ -167,7 +168,6 @@
dbus_g_method_return (context, values);
g_strfreev (values);
g_free (service_id);
- g_free (service_result);
tracker_dbus_request_success (request_id);
}
Modified: trunk/src/trackerd/tracker-search.c
==============================================================================
--- trunk/src/trackerd/tracker-search.c (original)
+++ trunk/src/trackerd/tracker-search.c Thu Nov 20 16:15:59 2008
@@ -621,8 +621,8 @@
_tracker_db_result_set_append (result_set);
g_value_init (&value, G_TYPE_STRING);
- g_value_take_string (&value,
- tracker_ontology_get_service_by_id (count.service_type_id));
+ g_value_set_string (&value,
+ tracker_ontology_get_service_by_id (count.service_type_id));
_tracker_db_result_set_set_value (result_set, 0, &value);
g_value_unset (&value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]