[Mapserver-dev] the pfffurpose of getNumeric

Steve Lime steve.lime at dnr.state.mn.us
Thu May 27 17:48:20 EDT 2004


Had to think for a minute, really old code. It does what the comment
suggests...

/*
** Converts a string (e.g. form parameter) to a double, first checking
the format against
** a regular expression. Dumps an error immediately if the format test
fails.
*/

I was really into regex for awhile. Anyone see a reason not to use the
function below? If
not I'll swap'em...

Steve

>>> "Mladen Turk" <mturk at apache.org> 5/27/2004 8:54:26 AM >>>
Hi all,

I was wondering what is the purpose of the getNumeric function? 

For example IMHO the:

static double getNumeric(char *s)
{
	char *err;
	double rv;
	rv = strtod(s, &err);
	If (*err) {
    		msSetError(MS_TYPEERR, NULL, "getNumeric()"); 
    		writeError();
	}
	return rv;
}


has the same functionality as the existing one, but doesn't require
either
regex nor malloc/free for each param.

MT.




More information about the mapserver-dev mailing list