]> andersk Git - splint.git/blobdiff - src/multiVal.c
Fixed bug which would cause splint to crash if it was started with the -i flags and...
[splint.git] / src / multiVal.c
index 5659aafa72b565e2bc45ffa25887c36bba0f654c..5b9a2b0a8238c9ef9317796ddb7174edda5be57c 100644 (file)
@@ -351,9 +351,26 @@ multiVal multiVal_divide (multiVal m1, multiVal m2)
 
   switch (m1->kind)
     {
-    case MVLONG:   return (multiVal_makeInt (m1->value.ival / m2->value.ival));
-    case MVCHAR:   return (multiVal_makeChar ((char) (m1->value.cval / m2->value.cval)));
-    case MVDOUBLE: return (multiVal_makeDouble (m1->value.fval / m2->value.fval));
+    case MVLONG: 
+      if (m2->value.ival != 0)
+       {
+         return (multiVal_makeInt (m1->value.ival / m2->value.ival));
+       }
+      else
+       {
+         return multiVal_undefined;
+       }
+    case MVCHAR:   
+      if (m2->value.cval != (char) 0)
+       {
+         return (multiVal_makeChar ((char) (m1->value.cval / m2->value.cval)));
+       }
+      else
+       {
+         return multiVal_undefined;
+       }
+    case MVDOUBLE:
+      return multiVal_undefined; /* Don't attempt to divide floats */
     case MVSTRING: return multiVal_undefined;
     }
 
This page took 0.031707 seconds and 4 git commands to generate.