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

◆ trim()

static char * trim ( const char *  input)
static

Definition at line 265 of file raster2pgsql.c.

265 {
266 char *rtn;
267 char *ptr;
268 uint32_t offset = 0;
269 size_t len = 0;
270
271 if (!input)
272 return NULL;
273 else if (!*input)
274 return (char *) input;
275
276 /* trim left */
277 while (isspace(*input))
278 input++;
279
280 /* trim right */
281 ptr = ((char *) input) + strlen(input);
282 while (isspace(*--ptr))
283 offset++;
284
285 len = strlen(input) - offset + 1;
286 rtn = rtalloc(sizeof(char) * len);
287 if (NULL == rtn) {
288 rterror(_("trim: Not enough memory"));
289 return NULL;
290 }
291 strncpy(rtn, input, len);
292
293 return rtn;
294}
void rterror(const char *fmt,...)
Wrappers used for reporting errors and info.
Definition rt_context.c:199
void * rtalloc(size_t size)
Wrappers used for managing memory.
Definition rt_context.c:171
#define _(String)
Definition shpcommon.h:24

References _, rtalloc(), and rterror().

Referenced by _rti_raster_get_band_perimeter(), main(), and rt_raster_get_perimeter().

Here is the call graph for this function:
Here is the caller graph for this function: