[GRASS-SVN] r60711 - grass/trunk/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jun 4 17:22:24 PDT 2014


Author: hcho
Date: 2014-06-04 17:22:24 -0700 (Wed, 04 Jun 2014)
New Revision: 60711

Modified:
   grass/trunk/lib/gis/parser.c
Log:
add_exclusive(): refactored to avoid double find_exclusive calls

Modified: grass/trunk/lib/gis/parser.c
===================================================================
--- grass/trunk/lib/gis/parser.c	2014-06-04 23:39:07 UTC (rev 60710)
+++ grass/trunk/lib/gis/parser.c	2014-06-05 00:22:24 UTC (rev 60711)
@@ -851,20 +851,19 @@
 	    name[len] = 0;
 
 	    if (!(exclusive = find_exclusive(name))) {
-		exclusive = &st->exclusive[st->n_exclusive++];
-		exclusive->name = name;
-		exclusive->allocated_keys = 10;
-		exclusive->n_keys = 0;
-		exclusive->keys = G_malloc(exclusive->allocated_keys *
-					   sizeof(char *));
-
 		if (st->n_exclusive >= st->allocated_exclusive) {
 		    st->allocated_exclusive += 10;
 		    st->exclusive = G_realloc(st->exclusive,
 				    	      st->allocated_exclusive *
 					      sizeof(struct Exclusive));
-		    exclusive = find_exclusive(name);
 		}
+
+		exclusive = &st->exclusive[st->n_exclusive++];
+		exclusive->name = name;
+		exclusive->allocated_keys = 10;
+		exclusive->n_keys = 0;
+		exclusive->keys = G_malloc(exclusive->allocated_keys *
+					   sizeof(char *));
 	    }
 
 	    if (!has_exclusive_key(exclusive->n_keys, exclusive->keys,



More information about the grass-commit mailing list