From: Sandro Santilli Date: Mon, 6 Jul 2009 16:07:03 +0000 (+0000) Subject: Don't use strtok_r, to help with MingW builds. X-Git-Tag: 1.5.0b1~594 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c7c245df4115c6bfce813b6ffc880fb36e540bff;p=postgis Don't use strtok_r, to help with MingW builds. git-svn-id: http://svn.osgeo.org/postgis/trunk@4262 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/lwgeom_geos.c b/postgis/lwgeom_geos.c index d2e5cbcef..eb785c31a 100644 --- a/postgis/lwgeom_geos.c +++ b/postgis/lwgeom_geos.c @@ -862,7 +862,6 @@ Datum buffer(PG_FUNCTION_ARGS) int joinStyle = DEFAULT_JOIN_STYLE; char *param; char *params = NULL; - char *saveptr = NULL; PROFSTART(PROF_QRUN); @@ -887,24 +886,21 @@ Datum buffer(PG_FUNCTION_ARGS) for (param=params; ; param=NULL) { - char *saveptr2, *key, *val; - param = strtok_r(param, " ", &saveptr); + char *key, *val; + param = strtok(param, " "); if ( param == NULL ) break; - /* lwnotice("Param: %s", param); */ + POSTGIS_DEBUGF(3, "Param: %s", param); - key = strtok_r(param, "=", &saveptr2); - if ( key == NULL ) { - lwerror("Malformed buffer parameter"); - break; - } - val = strtok_r(NULL, "=", &saveptr2); - if ( val == NULL ) { + key = param; + val = strchr(key, '='); + if ( val == NULL || *(val+1) == '\0' ) { lwerror("Missing value for buffer " "parameter %s", key); break; } + *val = '\0'; ++val; - /* lwnotice("Param: %s : %s", key, val); */ + POSTGIS_DEBUGF(3, "Param: %s : %s", key, val); if ( !strcmp(key, "endcap") ) { @@ -926,7 +922,7 @@ Datum buffer(PG_FUNCTION_ARGS) else { lwerror("Invalid buffer end cap " - "style: %s (accept " + "style: %s (accept: " "'round', 'flat' or 'square'" ")", val); break; @@ -950,7 +946,7 @@ Datum buffer(PG_FUNCTION_ARGS) else { lwerror("Invalid buffer end cap " - "style: %s (accept " + "style: %s (accept: " "'round', 'mitre' or 'bevel'" ")", val); break; @@ -968,7 +964,7 @@ Datum buffer(PG_FUNCTION_ARGS) } else { - lwerror("Invalid buffer parameter: %s (accept" + lwerror("Invalid buffer parameter: %s (accept: " "'endcap', 'join', 'mitre_limit' and " "'quad_segs')", key); break;