PostGIS  2.1.10dev-r@@SVN_REVISION@@
static char * rtpg_chartrim ( const char *  input,
char *  remove 
)
static

Definition at line 740 of file rt_pg.c.

References input().

Referenced by RASTER_reclass().

740  {
741  char *rtn = NULL;
742  char *ptr = NULL;
743  uint32_t offset = 0;
744 
745  if (!input)
746  return NULL;
747  else if (!*input)
748  return (char *) input;
749 
750  /* trim left */
751  while (strchr(remove, *input) != NULL)
752  input++;
753 
754  /* trim right */
755  ptr = ((char *) input) + strlen(input);
756  while (strchr(remove, *--ptr) != NULL)
757  offset++;
758 
759  rtn = palloc(sizeof(char) * (strlen(input) - offset + 1));
760  if (rtn == NULL) {
761  fprintf(stderr, "Not enough memory\n");
762  return NULL;
763  }
764  strncpy(rtn, input, strlen(input) - offset);
765  rtn[strlen(input) - offset] = '\0';
766 
767  return rtn;
768 }
static int input(void)

Here is the call graph for this function:

Here is the caller graph for this function: