diff options
author | allen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-09-11 14:38:21 +0000 |
---|---|---|
committer | allen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-09-11 14:38:21 +0000 |
commit | 4b1c576d6b637cd4253fe12d057ccf1c86d6d001 (patch) | |
tree | 57665a7b4e1a188f4073f93292954f3d120b02ad /src/util/Misc.c | |
parent | 99c06d289c00acc048e81d7e856bf80366653218 (diff) |
Null Terminate String now gives a warning if the length of the string
passed is more that 100000, since this always happens if you put the
wrong arguments in a call to C from Fortran. It lets you carry on,
since then you can use a debugger to see exactly where the problem
is without editting any par files.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@896 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/util/Misc.c')
-rw-r--r-- | src/util/Misc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util/Misc.c b/src/util/Misc.c index 00e4bb65..22716b3e 100644 --- a/src/util/Misc.c +++ b/src/util/Misc.c @@ -178,6 +178,16 @@ char *Util_NullTerminateString(const char *instring, unsigned int len) char *outstring; unsigned int i; + if (len > 100000) + { + char *message; + message = malloc(1024*sizeof(char)); + sprintf(message,"You are Null Terminating a string with length %d !!\n" + "This is probably an error in calling a C routine from Fortran",len); + CCTK_Warn(1,__LINE__,__FILE__,"Cactus",message); + free(message); + } + #ifdef DEBUG_MISC printf("Util_NullTerminateString: -%s-, (%u)\n",instring,len); #endif |