aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880>2001-06-14 12:18:49 +0000
committertradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880>2001-06-14 12:18:49 +0000
commit9736db99b9a8097668f8566914f0a5891483d11e (patch)
treeb56e607d754f6b14b85753ee8b53a8b5983df614
parent83f7324d1f2bdb04c4661c55e601bb1caf7e6892 (diff)
Fixed problem with 'char * = const char *' assignment which didn't compile
on a T3E. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOBasic/trunk@91 b589c3ab-70e8-4b4d-a09f-cba2dd200880
-rw-r--r--src/WriteGF.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/WriteGF.c b/src/WriteGF.c
index 8aca45d..ef7378b 100644
--- a/src/WriteGF.c
+++ b/src/WriteGF.c
@@ -80,11 +80,16 @@ void IOBasic_WriteGF (cGH *GH,
struct stat fileinfo;
ioAdvertisedFileDesc advertised_file;
CCTK_REAL reduction_value;
- /* add more reductions to this table if you want, telling it
- - the reduction operator
- - the label for the file header
- - the filename extension (suffixed by ".tl" for trace line) */
+ union
+ {
+ char *non_const_ptr;
+ const char *const_ptr;
+ } reductions;
+
+ /* this union helps us to avoid compiler warning about discarding
+ the const qualifier from a pointer target type */
+ reductions.const_ptr = outScalar_reductions;
/* first, check if variable has storage assigned */
if (! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (vindex)))
@@ -117,12 +122,12 @@ void IOBasic_WriteGF (cGH *GH,
/* allocate strings for the filename and the reduction operator */
filename = (char *) malloc (strlen (myGH->outdirScalar) + strlen (alias) +
- strlen (outScalar_reductions) +
+ strlen (reductions.const_ptr) +
strlen (file_extension) + 3);
- reduction_op = (char *) malloc (strlen (outScalar_reductions) + 1);
+ reduction_op = (char *) malloc (strlen (reductions.const_ptr) + 1);
/* now loop over all reduction operators */
- string_start = outScalar_reductions;
+ string_start = reductions.non_const_ptr;
while (string_start && *string_start)
{
/* skip leading spaces */