PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ rtpg_chartrim()

char * rtpg_chartrim ( const char *  input,
char *  remove 
)

Definition at line 110 of file rtpg_internal.c.

110 {
111 char *rtn = NULL;
112 char *ptr = NULL;
113 uint32_t offset = 0;
114
115 if (!input)
116 return NULL;
117 else if (!*input)
118 return (char *) input;
119
120 /* trim left */
121 while (strchr(remove, *input) != NULL)
122 input++;
123
124 /* trim right */
125 ptr = ((char *) input) + strlen(input);
126 while (strchr(remove, *--ptr) != NULL)
127 offset++;
128
129 rtn = palloc(sizeof(char) * (strlen(input) - offset + 1));
130 if (!rtn) {
131 fprintf(stderr, "Not enough memory\n");
132 return NULL;
133 }
134 memcpy(rtn, input, strlen(input) - offset);
135 rtn[strlen(input) - offset] = '\0';
136
137 return rtn;
138}

Referenced by RASTER_reclass().

Here is the caller graph for this function: