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

◆ trim()

static char * trim ( const char *  input)
static

Definition at line 274 of file raster2pgsql.c.

274 {
275 char *rtn;
276 char *ptr;
277 uint32_t offset = 0;
278 size_t len = 0;
279
280 if (!input)
281 return NULL;
282 else if (!*input)
283 return (char *) input;
284
285 /* trim left */
286 while (isspace(*input))
287 input++;
288
289 /* trim right */
290 ptr = ((char *) input) + strlen(input);
291 while (isspace(*--ptr))
292 offset++;
293
294 len = strlen(input) - offset + 1;
295 rtn = rtalloc(sizeof(char) * len);
296 if (NULL == rtn) {
297 rterror(_("trim: Not enough memory"));
298 return NULL;
299 }
300 strncpy(rtn, input, len);
301
302 return rtn;
303}
void rterror(const char *fmt,...) __attribute__((format(printf
Wrappers used for reporting errors and info.
void * rtalloc(size_t size)
Wrappers used for managing memory.
Definition rt_context.c:191
#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: