Преглед на файлове

rtree search optimization: pass pointer instead of struct

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@52543 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz преди 12 години
родител
ревизия
99b617473c
променени са 3 файла, в които са добавени 4 реда и са изтрити 4 реда
  1. 1 1
      lib/vector/rtree/indexf.c
  2. 1 1
      lib/vector/rtree/indexm.c
  3. 2 2
      lib/vector/rtree/rtree.h

+ 1 - 1
lib/vector/rtree/indexf.c

@@ -84,7 +84,7 @@ int RTreeSearchF(struct RTree *t, struct RTree_Rect *r,
 		    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;
 			}

+ 1 - 1
lib/vector/rtree/indexm.c

@@ -77,7 +77,7 @@ int RTreeSearchM(struct RTree *t, struct RTree_Rect *r,
 		    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;
 			}

+ 2 - 2
lib/vector/rtree/rtree.h

@@ -85,11 +85,11 @@ struct RTree_Node       /* node for spatial index */
  * 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 *);