summaryrefslogtreecommitdiff
path: root/src/main/Parameters.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/Parameters.c')
-rw-r--r--src/main/Parameters.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/main/Parameters.c b/src/main/Parameters.c
index 09b3c8b8..01017d38 100644
--- a/src/main/Parameters.c
+++ b/src/main/Parameters.c
@@ -868,6 +868,15 @@ char *CCTK_ParameterValString (const char *param_name, const char *thorn)
return (retval);
}
+const int slen(const char *s) {
+ int n = 0;
+ while(*s != '\0') {
+ s++;
+ n++;
+ }
+ return n;
+}
+
/*@@
@routine CCTK_PARAMETERVALSTRING
@date Thu Jan 21 2000
@@ -910,7 +919,7 @@ void CCTK_FCALL CCTK_FNAME (CCTK_ParameterValString)
c_string = CCTK_ParameterValString (param, thorn);
if (c_string)
{
- *nchars = c_strlen = strlen (c_string);
+ *nchars = c_strlen = slen (c_string);
if (c_strlen > (size_t) cctk_strlen3)
{
CCTK_VWarn (1, __LINE__, __FILE__, "Cactus",
@@ -1081,8 +1090,8 @@ int CCTK_ParameterWalk (int first,
prefix = CCTK_ThornImplementation (prefix);
}
- *pfullname = malloc (strlen (prefix) +
- strlen (startpoint->props->name) + 3);
+ *pfullname = malloc (slen (prefix) +
+ slen (startpoint->props->name) + 3);
if(*pfullname)
{
sprintf (*pfullname, "%s::%s",
@@ -2299,7 +2308,7 @@ static int ParameterSetReal (t_param *param, const char *value)
* to do the actual conversion) only groks [eE].
*/
temp = strdup (value);
- for (unsigned int p = 0; p < strlen (temp); p++)
+ for (unsigned int p = 0; p < slen (temp); p++)
{
if (temp[p] == 'E' || temp[p] == 'd' || temp[p] == 'D')
{
@@ -2490,7 +2499,7 @@ static void GetBaseName(const char *name, char **basename, int *array_index)
}
else
{
- baselen = strlen(name);
+ baselen = slen(name);
*array_index = -1;
}
@@ -2533,7 +2542,7 @@ static char *ArrayParamName(const char *basename,int array_index)
char *retval;
/* Assume the string representation of an integer is no greater than 40 chars */
- retval = (char *)malloc(strlen(basename)+2+40+1);
+ retval = (char *)malloc(slen(basename)+2+40+1);
if(retval)
{
@@ -2742,7 +2751,7 @@ static int SetVarEvaluator(int nvars, const char * const *vars, uExpressionValue
* to do the actual conversion) only groks [eE].
*/
temp = strdup (vars[i]);
- for (unsigned int p = 0; p < strlen (temp); p++)
+ for (unsigned int p = 0; p < slen (temp); p++)
{
if (temp[p] == 'E' || temp[p] == 'd' || temp[p] == 'D')
{