[mapserver-commits] r11036 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Tue Mar 1 09:46:02 EST 2011


Author: sdlime
Date: 2011-03-01 06:46:02 -0800 (Tue, 01 Mar 2011)
New Revision: 11036

Modified:
   trunk/mapserver/mapfile.c
   trunk/mapserver/mapserver.h
Log:
Split out a freeExpressionTokens() function from freeExpression().

Modified: trunk/mapserver/mapfile.c
===================================================================
--- trunk/mapserver/mapfile.c	2011-03-01 14:18:47 UTC (rev 11035)
+++ trunk/mapserver/mapfile.c	2011-03-01 14:46:02 UTC (rev 11036)
@@ -1927,16 +1927,13 @@
   exp->tokens = exp->curtoken = NULL;
 }
 
-void freeExpression(expressionObj *exp)
+void freeExpressionTokens(expressionObj *exp)
 {
   tokenListNodeObjPtr node = NULL;
   tokenListNodeObjPtr nextNode = NULL;
 
   if(!exp) return;
 
-  msFree(exp->string);
-  if((exp->type == MS_REGEX) && exp->compiled) ms_regfree(&(exp->regex));
-
   if(exp->tokens) {
     node = exp->tokens;
     while (node != NULL) {
@@ -1964,8 +1961,16 @@
       msFree(node);
       node = nextNode;
     }
+    exp->tokens = exp->curtoken = NULL;
   }
+}
 
+void freeExpression(expressionObj *exp)
+{
+  if(!exp) return;
+  msFree(exp->string);
+  if((exp->type == MS_REGEX) && exp->compiled) ms_regfree(&(exp->regex));
+  freeExpressionTokens(exp);
   initExpression(exp); /* re-initialize */
 }
 

Modified: trunk/mapserver/mapserver.h
===================================================================
--- trunk/mapserver/mapserver.h	2011-03-01 14:18:47 UTC (rev 11035)
+++ trunk/mapserver/mapserver.h	2011-03-01 14:46:02 UTC (rev 11036)
@@ -1690,6 +1690,7 @@
 MS_DLL_EXPORT int msLoadExpressionString(expressionObj *exp, char *value);
 MS_DLL_EXPORT char *msGetExpressionString(expressionObj *exp);
 MS_DLL_EXPORT void initExpression(expressionObj *exp);
+MS_DLL_EXPORT void freeExpressionTokens(expressionObj *exp);
 MS_DLL_EXPORT void freeExpression(expressionObj *exp);
 
 MS_DLL_EXPORT void msLayerSubstituteString(layerObj *layer, const char *from, const char *to);



More information about the mapserver-commits mailing list