[anjuta/sdb-core-trans] symbol-db: complete removal of memory pool.
- From: Massimo Cora' <mcora src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta/sdb-core-trans] symbol-db: complete removal of memory pool.
- Date: Mon, 12 Jul 2010 14:03:51 +0000 (UTC)
commit 5b41114a1faee37d39b5ac682ba7dbae8066a89c
Author: Massimo Corà <mcora src gnome org>
Date: Mon Jul 12 16:01:25 2010 +0200
symbol-db: complete removal of memory pool.
plugins/symbol-db/symbol-db-engine-core.c | 53 ++---------------------------
plugins/symbol-db/symbol-db-engine-priv.h | 28 ---------------
2 files changed, 3 insertions(+), 78 deletions(-)
---
diff --git a/plugins/symbol-db/symbol-db-engine-core.c b/plugins/symbol-db/symbol-db-engine-core.c
index c726b5f..006624d 100644
--- a/plugins/symbol-db/symbol-db-engine-core.c
+++ b/plugins/symbol-db/symbol-db-engine-core.c
@@ -1445,7 +1445,6 @@ sdb_engine_init (SymbolDBEngine * object)
{
SymbolDBEngine *sdbe;
GHashTable *h;
- gint i;
sdbe = SYMBOL_DB_ENGINE (object);
sdbe->priv = g_new0 (SymbolDBEnginePriv, 1);
@@ -1817,27 +1816,6 @@ sdb_engine_init (SymbolDBEngine * object)
/* init table maps */
sdb_engine_init_table_maps (sdbe);
-
- /* init memory pool object for GValue strings */
- sdbe->priv->mem_pool_string = g_queue_new ();
- sdbe->priv->mem_pool_int = g_queue_new ();
-
- for (i = 0; i < MEMORY_POOL_STRING_SIZE; i++)
- {
- GValue *value = g_slice_new0 (GValue);
- g_value_init (value, G_TYPE_STRING);
- g_value_set_static_string (value, MP_VOID_STRING);
-
- g_queue_push_head (sdbe->priv->mem_pool_string, value);
- }
-
- for (i = 0; i < MEMORY_POOL_INT_SIZE; i++)
- {
- GValue *value = g_slice_new0 (GValue);
- g_value_init (value, G_TYPE_INT);
-
- g_queue_push_head (sdbe->priv->mem_pool_int, value);
- }
}
static void
@@ -1852,12 +1830,6 @@ sdb_engine_unref_removed_launchers (gpointer data, gpointer user_data)
g_object_unref (data);
}
-static void
-sdb_engine_gvalue_free (gpointer data, gpointer user_data)
-{
- g_slice_free (GValue, data);
-}
-
static void
sdb_engine_finalize (GObject * object)
{
@@ -1971,15 +1943,6 @@ sdb_engine_finalize (GObject * object)
g_free (priv->ctags_path);
priv->ctags_path = NULL;
- g_queue_foreach (priv->mem_pool_string, (GFunc)sdb_engine_gvalue_free, NULL);
- g_queue_free (priv->mem_pool_string);
-
- g_queue_foreach (priv->mem_pool_int, (GFunc)sdb_engine_gvalue_free, NULL);
- g_queue_free (priv->mem_pool_int);
-
- priv->mem_pool_string = NULL;
- priv->mem_pool_int = NULL;
-
g_free (priv);
G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -2945,8 +2908,6 @@ sdb_engine_add_new_db_file (SymbolDBEngine * dbe, const gchar * project_name,
return FALSE;
}
- MP_RESET_PLIST(plist);
-
SDB_UNLOCK(priv);
return TRUE;
}
@@ -4480,8 +4441,6 @@ sdb_engine_add_new_symbol (SymbolDBEngine * dbe, const tagEntry * tag_entry,
g_error_free (error);
}
- MP_RESET_PLIST(plist);
-
if (sym_was_updated == FALSE)
{
if (nrows > 0)
@@ -4662,8 +4621,6 @@ sdb_engine_update_file (SymbolDBEngine * dbe, const gchar * file_on_db)
gda_connection_statement_execute_non_select (priv->db_connection, (GdaStatement*)stmt1,
(GdaSet*)plist1, NULL, NULL);
- MP_RESET_PLIST(plist1);
-
/* emits removed symbols signals */
sdb_engine_detects_removed_ids (dbe);
@@ -4805,7 +4762,6 @@ on_scan_update_files_symbols_end (SymbolDBEngine * dbe,
(GdaStatement*)stmt,
(GdaSet*)plist, NULL, NULL);
- MP_RESET_PLIST(plist);
SDB_UNLOCK(priv);
}
@@ -4955,8 +4911,7 @@ symbol_db_engine_update_project_symbols (SymbolDBEngine *dbe,
GDA_STATEMENT_MODEL_RANDOM_ACCESS,
gtype_array,
NULL);
- MP_RESET_PLIST(plist);
-
+
if (!GDA_IS_DATA_MODEL (data_model) ||
(num_rows = gda_data_model_get_n_rows (GDA_DATA_MODEL (data_model))) <= 0)
{
@@ -5142,10 +5097,8 @@ symbol_db_engine_remove_file (SymbolDBEngine * dbe, const gchar *project,
/* Triggers will take care of updating/deleting connected symbols
* tuples, like sym_kind, sym_type etc */
gda_connection_statement_execute_non_select (priv->db_connection, (GdaStatement*)stmt,
- (GdaSet*)plist, NULL, NULL);
-
- MP_RESET_PLIST(plist);
-
+ (GdaSet*)plist, NULL, NULL);
+
/* emits removed symbols signals */
sdb_engine_detects_removed_ids (dbe);
diff --git a/plugins/symbol-db/symbol-db-engine-priv.h b/plugins/symbol-db/symbol-db-engine-priv.h
index dea21dd..c48cc2c 100644
--- a/plugins/symbol-db/symbol-db-engine-priv.h
+++ b/plugins/symbol-db/symbol-db-engine-priv.h
@@ -49,32 +49,8 @@
#define THREADS_MAX_CONCURRENT 2
#define TRIGGER_SIGNALS_DELAY 100
-#define MEMORY_POOL_STRING_SIZE 40000
-#define MEMORY_POOL_INT_SIZE 40000
-
-#define DUMMY_VOID_STRING ""
-#define MP_VOID_STRING "-"
-
#define BATCH_SYMBOL_NUMBER 15000
-#define MP_RESET_OBJ_STR(gvalue) \
- g_value_set_static_string (gvalue, DUMMY_VOID_STRING);
-
-/* given a GdaSet plist this macro resets all the GValues associated within its
- * GdaHolders.
- */
-#define MP_RESET_PLIST(plist) { \
- if (plist != NULL) \
- { \
- GSList* holders; \
- for (holders = plist->holders; holders; holders = holders->next) { \
- GValue *gvalue = (GValue*)gda_holder_get_value (holders->data); \
- if (G_VALUE_HOLDS_STRING(gvalue)) \
- MP_RESET_OBJ_STR(gvalue); \
- } \
- } \
-}
-
#define SDB_QUERY_SEARCH_HEADER \
GValue v = {0}; \
SymbolDBQueryPriv *priv; \
@@ -221,10 +197,6 @@ struct _SymbolDBEnginePriv
static_query_node *static_query_list[PREP_QUERY_COUNT];
- /* Memory pool */
- GQueue *mem_pool_string;
- GQueue *mem_pool_int;
-
#ifdef DEBUG
GTimer *first_scan_timer_DEBUG;
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]