aboutsummaryrefslogtreecommitdiff
path: root/src/CheckpointRecovery.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/CheckpointRecovery.c')
-rw-r--r--src/CheckpointRecovery.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/CheckpointRecovery.c b/src/CheckpointRecovery.c
index b512e50..7328a7f 100644
--- a/src/CheckpointRecovery.c
+++ b/src/CheckpointRecovery.c
@@ -146,7 +146,7 @@ int IOUtil_RegisterRecover (const char *name,
@var GH
@vdesc Pointer to CCTK grid hierarchy
- @vtype cGH *
+ @vtype const cGH *
@vio in
@endvar
@var basefilename
@@ -177,7 +177,7 @@ int IOUtil_RegisterRecover (const char *name,
@vio in
@endvar
@@*/
-void IOUtil_PrepareFilename (cGH *GH,
+void IOUtil_PrepareFilename (const cGH *GH,
const char *basefilename,
char *fname,
int called_from,
@@ -597,7 +597,7 @@ int IOUtil_RecoverParameters (int (*recoverFn) (cGH *GH,
@var GH
@vdesc Pointer to CCTK grid hierarchy
- @vtype cGH *
+ @vtype const cGH *
@vio in
@endvar
@@ -605,7 +605,7 @@ int IOUtil_RecoverParameters (int (*recoverFn) (cGH *GH,
@returndesc the allocated string or NULL
@endreturndesc
@@*/
-char *IOUtil_GetAllParameters (cGH *GH)
+char *IOUtil_GetAllParameters (const cGH *GH)
{
int i, first;
char *param;
@@ -691,22 +691,23 @@ char *IOUtil_GetAllParameters (cGH *GH)
@var parameters
@vdesc the parameter string
- @vtype char *
+ @vtype const char *
@vio in
@endvar
@@*/
-void IOUtil_SetAllParameters (char *parameters)
+void IOUtil_SetAllParameters (const char *parameters)
{
DECLARE_CCTK_PARAMETERS
char *tmp, *nextparam, *avalue, *param;
char oldchar;
- char *name, *thorn_impl;
+ char *name, *thorn_impl, *parameter_string, *free_me;
const char *thorn;
- while (*parameters)
+ parameter_string = free_me = strdup (parameters);
+ while (*parameter_string)
{
- nextparam = parameters;
+ nextparam = parameter_string;
while (*nextparam != '\n' && *nextparam)
{
nextparam++;
@@ -714,14 +715,14 @@ void IOUtil_SetAllParameters (char *parameters)
oldchar = *nextparam;
*nextparam = 0;
- tmp = parameters;
+ tmp = parameter_string;
while (*tmp != ' ')
{
tmp++;
}
*tmp = 0;
- param = parameters;
+ param = parameter_string;
avalue = tmp + 3;
name = thorn_impl = NULL;
@@ -755,12 +756,14 @@ void IOUtil_SetAllParameters (char *parameters)
}
*nextparam = oldchar;
- parameters = nextparam;
- if (*parameters == '\n')
+ parameter_string = nextparam;
+ if (*parameter_string == '\n')
{
- parameters++;
+ parameter_string++;
}
}
+
+ free (free_me);
}