summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorallen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-04-05 15:22:04 +0000
committerallen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-04-05 15:22:04 +0000
commita4009e04b0be3dbdcfc86630d01deb7570b98024 (patch)
tree465a54bd78a6f9502fbe83c60423b7e7c993ccec /src/util
parent922f7b27d1d8c50765604bddb87ae92617a6651a (diff)
Finished error checking in CCTK_Equals
git-svn-id: http://svn.cactuscode.org/flesh/trunk@436 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/util')
-rw-r--r--src/util/Misc.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/util/Misc.c b/src/util/Misc.c
index 7dab703f..9c9604cc 100644
--- a/src/util/Misc.c
+++ b/src/util/Misc.c
@@ -104,11 +104,24 @@ int CCTK_Equals(const char *string1, const char *string2)
retval = 1;
/* Check that string1 isn't null */
- if (!string1 && string2)
+ if (!string1 || !string2)
{
- message = (char *)malloc((100+sizeof(string2))*sizeof(char));
- sprintf(message,"First string null in CCTK_Equals (2nd is %s)",string2);
- CCTK_Warn(0,message);
+ if (!string1 && string2)
+ {
+ message = (char *)malloc((100+sizeof(string2))*sizeof(char));
+ sprintf(message,"First string null in CCTK_Equals (2nd is %s)",string2);
+ CCTK_Warn(0,message);
+ }
+ else if (string1 && !string2)
+ {
+ message = (char *)malloc((100+sizeof(string1))*sizeof(char));
+ sprintf(message,"Second string null in CCTK_Equals (1st is %s)",string1);
+ CCTK_Warn(0,message);
+ }
+ else
+ {
+ CCTK_Warn(0,"Both strings null in CCTK_Equals");
+ }
}
if(strlen(string1)==strlen(string2))