[GRASS-SVN] r50492 - grass/branches/develbranch_6/vector/v.to.rast

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jan 27 05:23:30 EST 2012


Author: hamish
Date: 2012-01-27 02:23:30 -0800 (Fri, 27 Jan 2012)
New Revision: 50492

Modified:
   grass/branches/develbranch_6/vector/v.to.rast/support.c
Log:
less spinning of wheels (merge r50488 from trunk)

Modified: grass/branches/develbranch_6/vector/v.to.rast/support.c
===================================================================
--- grass/branches/develbranch_6/vector/v.to.rast/support.c	2012-01-27 10:22:08 UTC (rev 50491)
+++ grass/branches/develbranch_6/vector/v.to.rast/support.c	2012-01-27 10:23:30 UTC (rev 50492)
@@ -269,9 +269,15 @@
     switch (use) {
     case USE_ATTR:
 	{
-	    G_set_raster_cats_title("Labels", &rast_cats);
 	    int is_fp = G_raster_map_is_fp(rast_name, G_mapset());
 
+	    if (!label_column) {
+		G_verbose_message(_("Label column was not specified, no labels will be written"));
+		break;
+	    }
+
+	    G_set_raster_cats_title("Labels", &rast_cats);
+
 	    /* open vector map and database driver */
 	    Vect_open_old(&Map, vector_map, G_find_vector2(vector_map, ""));
 
@@ -303,18 +309,9 @@
 		G_malloc(sizeof(struct My_labels_rule) * nrec);
 
 	    /* get column type */
-	    if (!label_column) {
-		G_verbose_message(_("Label column was not specified, no labels will be written"));
-		db_close_database_shutdown_driver(Driver);
-		break;
-	    }
-	    else {
-		if ((col_type =
-		     db_column_Ctype(Driver, Fi->table,
-				     label_column)) == -1) {
-		    G_fatal_error(_("Column <%s> not found"), label_column);
-		}
-	    }
+	    if ((col_type =
+		 db_column_Ctype(Driver, Fi->table, label_column)) == -1)
+		G_fatal_error(_("Column <%s> not found"), label_column);
 
 	    /* for each attribute */
 	    for (i = 0; i < cvarr.n_values; i++) {



More information about the grass-commit mailing list