[libgda] Code cleanups



commit 5cce769d73caf4f508484597cb286503b4202bf1
Author: Vivien Malerba <malerba gnome-db org>
Date:   Wed Aug 24 21:44:44 2011 +0200

    Code cleanups

 libgda/gda-data-model-import.c |   24 ++++++++----------------
 libgda/gda-data-model-import.h |    2 +-
 libgda/libgda-paramlist.dtd    |    2 +-
 3 files changed, 10 insertions(+), 18 deletions(-)
---
diff --git a/libgda/gda-data-model-import.c b/libgda/gda-data-model-import.c
index d50378f..b25ffbc 100644
--- a/libgda/gda-data-model-import.c
+++ b/libgda/gda-data-model-import.c
@@ -1158,8 +1158,7 @@ clean_field_specs (GSList *fields)
 	GSList *list;
 	XmlColumnSpec *spec;
 
-	list = fields;
-	while (list) {
+	for (list = fields; list; list = list->next) {
 		spec = (XmlColumnSpec*)(list->data);
 		xmlFree (spec->id);
 		xmlFree (spec->name);
@@ -1169,8 +1168,6 @@ clean_field_specs (GSList *fields)
 		xmlFree (spec->table);
 		xmlFree (spec->ref);
 		xmlFree (spec);
-
-		list = g_slist_next (list);
 	}
 	g_slist_free (fields);
 }
@@ -1323,9 +1320,9 @@ init_xml_import (GdaDataModelImport *model)
 			return;
 		}
 
-		list = fields;
-		pos = 0;
-		while (list) {
+		for (list = fields, pos = 0;
+		     list;
+		     list = list->next, pos++) {
 			GdaColumn *column;
 			XmlColumnSpec *spec;
 
@@ -1338,9 +1335,7 @@ init_xml_import (GdaDataModelImport *model)
 			gda_column_set_dbms_type (column, (gchar*)spec->dbms_type);
 			gda_column_set_g_type (column, spec->gdatype);
 			gda_column_set_allow_null (column, spec->nullok);
-
-			list = g_slist_next (list);
-			pos++;
+			g_print ("New col %d type [%s]\n", pos, gda_g_type_to_string (gda_column_get_g_type (column)));
 		}
 		clean_field_specs (fields);
 
@@ -1661,9 +1656,9 @@ init_node_import (GdaDataModelImport *model)
 	if (str)
 		g_object_set_data_full (G_OBJECT (model), "descr", str, xmlFree);
 
-	list = fields;
-	pos = 0;
-	while (list) {
+	for (list = fields, pos = 0;
+	     list;
+	     list = list->next, pos++) {
 		GdaColumn *column;
 		XmlColumnSpec *spec;
 
@@ -1677,9 +1672,6 @@ init_node_import (GdaDataModelImport *model)
 		gda_column_set_allow_null (column, spec->nullok);
 
 		model->priv->columns = g_slist_prepend (model->priv->columns, gda_column_copy (column));
-
-		list = g_slist_next (list);
-		pos++;
 	}
 	clean_field_specs (fields);
 	model->priv->columns = g_slist_reverse (model->priv->columns);
diff --git a/libgda/gda-data-model-import.h b/libgda/gda-data-model-import.h
index d115738..3a202d6 100644
--- a/libgda/gda-data-model-import.h
+++ b/libgda/gda-data-model-import.h
@@ -68,7 +68,7 @@ struct _GdaDataModelImportClass {
  * all the data is copied in memory, and is thus not suitable for large data sets. Note that importing from an 
  * already-build XML tree will always result in a random access data model.
  *
- * Various import options can be specified using parameters in a #GdaParameterList object. The available options
+ * Various import options can be specified using parameters in a #GdaSet object. The available options
  * depend on the format of the imported data listed here:
  * <itemizedlist>
  *   <listitem><para>"SEPARATOR" (string, CVS import only): specifies the separator to consider</para></listitem>
diff --git a/libgda/libgda-paramlist.dtd b/libgda/libgda-paramlist.dtd
index c6a8e58..3c6617b 100644
--- a/libgda/libgda-paramlist.dtd
+++ b/libgda/libgda-paramlist.dtd
@@ -1,5 +1,5 @@
 <!--       libgda-paramlist.dtd
-	   DTD for GdaParameterList specifications
+	   DTD for GdaSet specifications
 	   Version 1.0
 	   Copyright (C) 2006 Vivien Malerba
 -->



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