[GRASS-SVN] r63164 - grass/branches/releasebranch_6_4/lib/vector/dglib

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Nov 26 10:52:16 PST 2014


Author: mmetz
Date: 2014-11-26 10:52:16 -0800 (Wed, 26 Nov 2014)
New Revision: 63164

Modified:
   grass/branches/releasebranch_6_4/lib/vector/dglib/sp-template.c
Log:
dglib: fix sp cache initialization (backport r63161)

Modified: grass/branches/releasebranch_6_4/lib/vector/dglib/sp-template.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/vector/dglib/sp-template.c	2014-11-26 18:51:55 UTC (rev 63163)
+++ grass/branches/releasebranch_6_4/lib/vector/dglib/sp-template.c	2014-11-26 18:52:16 UTC (rev 63164)
@@ -256,8 +256,18 @@
 			clipInput.nFromDistance = 0; \
 			if ( fnClip( pgraph , & clipInput , & clipOutput , pvClipArg ) ) continue; \
 		} \
-		pPredistItem = dglTreePredistAdd( pCache->pvPredist, DGL_NODE_ID(pDestination) ); \
-		if ( pPredistItem == NULL ) goto sp_error; \
+		findPredist.nKey = DGL_NODE_ID(pDestination); \
+		if ( (pPredistItem = avl_find( pCache->pvPredist, &findPredist)) == NULL ) { \
+			if ( (pPredistItem = dglTreePredistAdd( pCache->pvPredist, DGL_NODE_ID(pDestination) )) == NULL ) { \
+				pgraph->iErrno = DGL_ERR_MemoryExhausted; \
+				goto sp_error; \
+			} \
+		} \
+		else { \
+			if ( pPredistItem->nDistance <= clipOutput.nEdgeCost ) { \
+				continue; \
+			} \
+		} \
 		pPredistItem->nFrom      = nStart; \
 		pPredistItem->pnEdge     = pEdge; \
 		pPredistItem->nCost      = clipOutput.nEdgeCost; \



More information about the grass-commit mailing list