[anjuta/sdb-queries] symbol-db: Use array to pass query fields list instead of variable args.



commit 706bcf061257b83db4cc1db4b244ef875c072f55
Author: Naba Kumar <naba gnome org>
Date:   Sat Jun 5 11:31:54 2010 +0300

    symbol-db: Use array to pass query fields list instead of variable args.
    
    GInterface doesn't support variable args.

 libanjuta/interfaces/libanjuta.idl  |    2 +-
 plugins/symbol-db/symbol-db-query.c |   24 ++++++++----------------
 2 files changed, 9 insertions(+), 17 deletions(-)
---
diff --git a/libanjuta/interfaces/libanjuta.idl b/libanjuta/interfaces/libanjuta.idl
index 46424d4..c0af131 100644
--- a/libanjuta/interfaces/libanjuta.idl
+++ b/libanjuta/interfaces/libanjuta.idl
@@ -5357,7 +5357,7 @@ interface IAnjutaSymbolQuery
 	void ::async_result (GObject* result);
 	
 	void set_mode (IAnjutaSymbolQueryMode mode);
-	void set_fields (IAnjutaSymbolField field0, ...);
+	void set_fields (gint n_fields, IAnjutaSymbolField *fields);
 	void set_filters (IAnjutaSymbolType filters, gboolean includes_types);
 	void set_file_scope (IAnjutaSymbolQueryFileScope filescope_search);
 	void set_offset (gint offset);
diff --git a/plugins/symbol-db/symbol-db-query.c b/plugins/symbol-db/symbol-db-query.c
index d979272..e07345c 100644
--- a/plugins/symbol-db/symbol-db-query.c
+++ b/plugins/symbol-db/symbol-db-query.c
@@ -115,7 +115,8 @@ SdbQueryFieldSpec field_specs[] = {
 
 /* FIXME: This maps to the bit position of IAnjutaSymbolType enum. This can
  * easily get out of hand if IAnjutaSymbolType enum value and this is not
- * associated more concretely through DB.
+ * associated more concretely through DB. To do it properly, get this list
+ * from database directly instead of hardcoding here.
  */
 static gchar* kind_names[] =
 {
@@ -671,27 +672,18 @@ sdb_query_search_file (IAnjutaSymbolQuery *query, const gchar *search_string,
 }
 
 static void
-sdb_query_set_fields (IAnjutaSymbolQuery *query, IAnjutaSymbolField field0, ...)
+sdb_query_set_fields (IAnjutaSymbolQuery *query, gint n_fields,
+                      IAnjutaSymbolField *fields, GError **err)
 {
-	gint i = 0;
-	IAnjutaSymbolField arg;
-	va_list vl;
+	gint i;
 	SymbolDBQueryPriv *priv;
 
 	g_return_if_fail (SYMBOL_DB_IS_QUERY (query));
 
 	priv = SYMBOL_DB_QUERY (query)->priv;
-	va_start (vl, field0);
-	arg = field0;
-	priv->fields[i] = arg;
-	i++;
-	while (arg != IANJUTA_SYMBOL_FIELD_END)
-	{
-		arg = va_arg (vl, IAnjutaSymbolField);
-		priv->fields[i] = arg;
-		i++;
-	}
-	va_end (vl);
+	for (i = 0; i < n_fields; i++)
+		priv->fields[i] = fields[i];
+	priv->fields[i] = IANJUTA_SYMBOL_FIELD_END;
 }
 
 static void



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