PostGIS  2.1.10dev-r@@SVN_REVISION@@
void trim_trailing_zeros ( char *  num)

Definition at line 200 of file lwutil.c.

References LWDEBUGF.

Referenced by assvg_point_buf(), pointArray_svg_abs(), pointArray_svg_rel(), pointArray_to_geojson(), pointArray_toGML2(), pointArray_toGML3(), and pointArray_toX3D3().

201 {
202  char *ptr, *totrim=NULL;
203  int len;
204  int i;
205 
206  LWDEBUGF(3, "input: %s", str);
207 
208  ptr = strchr(str, '.');
209  if ( ! ptr ) return; /* no dot, no decimal digits */
210 
211  LWDEBUGF(3, "ptr: %s", ptr);
212 
213  len = strlen(ptr);
214  for (i=len-1; i; i--)
215  {
216  if ( ptr[i] != '0' ) break;
217  totrim=&ptr[i];
218  }
219  if ( totrim )
220  {
221  if ( ptr == totrim-1 ) *ptr = '\0';
222  else *totrim = '\0';
223  }
224 
225  LWDEBUGF(3, "output: %s", str);
226 }
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55

Here is the caller graph for this function: