Definition at line 55 of file rtpg_internal.c.
60 const char *tmp =
str;
63 int64_t length, reslen;
64 size_t oldlen = strlen(oldstr);
65 size_t newlen = strlen(newstr);
69 while ((tmp = strstr(tmp, oldstr)) != NULL && found != limit)
70 found++, tmp += oldlen;
72 length = strlen(
str) + found * (newlen - oldlen);
73 if ((result = (
char *) palloc(length + 1)) == NULL) {
74 fprintf(stderr,
"Not enough memory\n");
83 while ((limit-- > 0) && (tmp = strstr(tmp, oldstr)) != NULL) {
85 strncpy(result + reslen,
str, length);
86 strcpy(result + (reslen += length), newstr);
92 strcpy(result + reslen,
str);
References genraster::count, and str.
Referenced by RASTER_colorMap(), RASTER_mapAlgebra2(), RASTER_mapAlgebraExpr(), RASTER_nMapAlgebraExpr(), and rtpg_removespaces().