[GRASS-SVN] r52726 - grass/branches/releasebranch_6_4/raster/r.mapcalc
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Aug 19 01:12:40 PDT 2012
Author: neteler
Date: 2012-08-19 01:12:40 -0700 (Sun, 19 Aug 2012)
New Revision: 52726
Modified:
grass/branches/releasebranch_6_4/raster/r.mapcalc/expression.c
Log:
Eliminate fixed-size buffer (backport from trunk, r52725)
Modified: grass/branches/releasebranch_6_4/raster/r.mapcalc/expression.c
===================================================================
--- grass/branches/releasebranch_6_4/raster/r.mapcalc/expression.c 2012-08-18 18:02:13 UTC (rev 52725)
+++ grass/branches/releasebranch_6_4/raster/r.mapcalc/expression.c 2012-08-19 08:12:40 UTC (rev 52726)
@@ -373,7 +373,8 @@
static char *format_function(const expression * e, int prec)
{
- char *args[1024];
+ char **args = NULL;
+ int num_args = 0;
char *result;
int len;
int i;
@@ -384,6 +385,10 @@
len = strlen(e->data.func.name) + 3;
for (i = 1; i <= e->data.func.argc; i++) {
+ if (i >= num_args) {
+ num_args = i + 1000;
+ args = G_realloc(args, num_args * sizeof(char *));
+ }
args[i] = format_expression_prec(e->data.func.args[i], 9);
if (i > 1)
len += 2;
More information about the grass-commit
mailing list