PostGIS  2.1.10dev-r@@SVN_REVISION@@
static char * rtpg_trim ( const char *  input)
static

Definition at line 856 of file rt_pg.c.

References input().

Referenced by _PG_init(), RASTER_asGDALRaster(), RASTER_asRaster(), RASTER_colorMap(), RASTER_GDALWarp(), RASTER_mapAlgebra2(), RASTER_nMapAlgebra(), and RASTER_nMapAlgebraExpr().

856  {
857  char *rtn;
858  char *ptr;
859  uint32_t offset = 0;
860  int inputlen = 0;
861 
862  if (!input)
863  return NULL;
864  else if (!*input)
865  return (char *) input;
866 
867  /* trim left */
868  while (isspace(*input) && *input != '\0')
869  input++;
870 
871  /* trim right */
872  inputlen = strlen(input);
873  if (inputlen) {
874  ptr = ((char *) input) + inputlen;
875  while (isspace(*--ptr))
876  offset++;
877  }
878 
879  rtn = palloc(sizeof(char) * (inputlen - offset + 1));
880  if (rtn == NULL) {
881  fprintf(stderr, "Not enough memory\n");
882  return NULL;
883  }
884  strncpy(rtn, input, inputlen - offset);
885  rtn[inputlen - offset] = '\0';
886 
887  return rtn;
888 }
static int input(void)

Here is the call graph for this function:

Here is the caller graph for this function: