[GRASS-SVN] r52543 - grass/trunk/lib/vector/rtree

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Aug 5 13:22:06 PDT 2012


Author: mmetz
Date: 2012-08-05 13:22:06 -0700 (Sun, 05 Aug 2012)
New Revision: 52543

Modified:
   grass/trunk/lib/vector/rtree/indexf.c
   grass/trunk/lib/vector/rtree/indexm.c
   grass/trunk/lib/vector/rtree/rtree.h
Log:
rtree search optimization: pass pointer instead of struct

Modified: grass/trunk/lib/vector/rtree/indexf.c
===================================================================
--- grass/trunk/lib/vector/rtree/indexf.c	2012-08-05 19:42:38 UTC (rev 52542)
+++ grass/trunk/lib/vector/rtree/indexf.c	2012-08-05 20:22:06 UTC (rev 52543)
@@ -84,7 +84,7 @@
 		    hitCount++;
 		    if (shcb) {	/* call the user-provided callback */
 			if (!shcb(s[top].sn.branch[i].child.id,
-			          s[top].sn.branch[i].rect, cbarg)) {
+			          &s[top].sn.branch[i].rect, cbarg)) {
 			    /* callback wants to terminate search early */
 			    return hitCount;
 			}

Modified: grass/trunk/lib/vector/rtree/indexm.c
===================================================================
--- grass/trunk/lib/vector/rtree/indexm.c	2012-08-05 19:42:38 UTC (rev 52542)
+++ grass/trunk/lib/vector/rtree/indexm.c	2012-08-05 20:22:06 UTC (rev 52543)
@@ -77,7 +77,7 @@
 		    hitCount++;
 		    if (shcb) {	/* call the user-provided callback */
 			if (!shcb(s[top].sn->branch[i].child.id,
-			          s[top].sn->branch[i].rect, cbarg)) {
+			          &s[top].sn->branch[i].rect, cbarg)) {
 			    /* callback wants to terminate search early */
 			    return hitCount;
 			}

Modified: grass/trunk/lib/vector/rtree/rtree.h
===================================================================
--- grass/trunk/lib/vector/rtree/rtree.h	2012-08-05 19:42:38 UTC (rev 52542)
+++ grass/trunk/lib/vector/rtree/rtree.h	2012-08-05 20:22:06 UTC (rev 52543)
@@ -85,11 +85,11 @@
  * It can terminate the search early by returning 0 in which case
  * the search will return the number of hits found up to that point.
  */
-typedef int SearchHitCallback(int id, struct RTree_Rect rect, void *arg);
+typedef int SearchHitCallback(int id, const struct RTree_Rect *rect, void *arg);
 
 struct RTree;
 
-typedef int rt_search_fn(struct RTree *, struct RTree_Rect *,
+typedef int rt_search_fn(struct RTree *, const struct RTree_Rect *,
                          SearchHitCallback *, void *);
 typedef int rt_insert_fn(struct RTree_Rect *, union RTree_Child, int, struct RTree *);
 typedef int rt_delete_fn(struct RTree_Rect *, union RTree_Child, struct RTree *);



More information about the grass-commit mailing list