diff options
author | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2001-10-23 13:02:25 +0000 |
---|---|---|
committer | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2001-10-23 13:02:25 +0000 |
commit | d9e8a71b489b93336e274c7faa67bb8053c0fd86 (patch) | |
tree | a17583ec5e91e3348f5283b6a0ed19864479fec3 /src/main/Groups.c | |
parent | fa2f5efa8be61057f6deb511c7b9bc8a22595228 (diff) |
Use the old regex parameter parsing to extract the sizes of variable dims.
The new expression parser is buggy for cases like '<param>+<constant>'.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@2420 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/Groups.c')
-rw-r--r-- | src/main/Groups.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/main/Groups.c b/src/main/Groups.c index 9113f454..1fc135e2 100644 --- a/src/main/Groups.c +++ b/src/main/Groups.c @@ -1902,7 +1902,7 @@ int CCTKi_CreateGroup (const char *gname, variable_name = va_arg (ap, char *); group->variables[variable].name = - (char *)malloc ((strlen (variable_name)+1*sizeof (char))); + (char *)malloc ((strlen (variable_name)+1)*sizeof (char)); if (group->variables[variable].name) { @@ -1920,7 +1920,7 @@ int CCTKi_CreateGroup (const char *gname, for (variable = 0; variable < n_variables; variable++) { - char *name; + char *name = NULL; Util_asprintf(&name, "%s[%d]", variable_name, variable); group->variables[variable].name = name; @@ -2132,14 +2132,20 @@ static CCTK_INT **CCTKi_ExtractSize (int dimension, const char *last_comma, *next_comma; char *thorn, *param, *tmp; regmatch_t pmatch[5]; +/*** FIXME: TR 23 Oct 2001 - switch back to old regex parsing + the parameter expression parser has a bug for parsing tokens + like '<parameter>+<constant>' (try AHFinder testsuites) ***/ +#define USE_REGEX_PARSER 1 +#ifndef USE_REGEX_PARSER CCTK_INT size; +#endif if (strlen (sizestring)) { size_array = (CCTK_INT **) malloc (dimension * sizeof (CCTK_INT *)); -#if 1 +#ifndef USE_REGEX_PARSER size_array[0] = (CCTK_INT *) malloc(dimension *sizeof(CCTK_INT)); for(dim = 1; dim < dimension; dim++) @@ -2165,7 +2171,7 @@ static CCTK_INT **CCTKi_ExtractSize (int dimension, tmp[next_comma-last_comma] = '\0'; } -#if 0 +#ifdef USE_REGEX_PARSER /* now execute the regex parser on that token This should always succeed since the perl parser did the same check already when creating the variable bindings. */ @@ -2230,12 +2236,11 @@ static CCTK_INT **CCTKi_ExtractSize (int dimension, free (thorn); free (param); } -#endif -#if 1 +#else size = CCTKi_ParamExpressionToInt(tmp, this_thorn); *size_array[dim] = size; -#endif +#endif /* USE_REGEX_PARSER */ free (tmp); } |