From 9736db99b9a8097668f8566914f0a5891483d11e Mon Sep 17 00:00:00 2001 From: tradke Date: Thu, 14 Jun 2001 12:18:49 +0000 Subject: 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 --- src/WriteGF.c | 19 ++++++++++++------- 1 file 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 */ -- cgit v1.2.3