]> andersk Git - splint.git/blobdiff - src/constraintTerm.c
Changes to fix malloc size problem.
[splint.git] / src / constraintTerm.c
index 807a0bdbeafeee73dd1ec8e2e4c03d36e098a3b8..60fe0518203c0436ee6501e5500369bffb97c6b7 100644 (file)
@@ -206,17 +206,17 @@ constraintTermType constraintTerm_getKind (constraintTerm t)
   return (t->value.sref);
 }
 
-/*@only@*/ constraintTerm constraintTerm_makeExprNode (/*@dependent@*/  exprNode e)
+/*@only@*/ constraintTerm constraintTerm_makeExprNode (/*@dependent@*/ exprNode e)
 {
-  constraintTerm ret = new_constraintTermExpr();
-  ret->loc =  fileloc_copy(exprNode_getfileloc(e));
+  constraintTerm ret = new_constraintTermExpr ();
+  ret->loc =  fileloc_copy (exprNode_loc (e));
   ret->value.expr = e;
   ret->kind = CTT_EXPR;
-  ret = constraintTerm_simplify(ret);
+  ret = constraintTerm_simplify (ret);
   return ret;
 }
 
-/*@only@*/ constraintTerm constraintTerm_makesRef  (/*@temp@*/ /*@observer@*/ sRef s)
+/*@only@*/ constraintTerm constraintTerm_makesRef (/*@temp@*/ /*@observer@*/ sRef s)
 {
   constraintTerm ret = new_constraintTermExpr();
   ret->loc =  fileloc_undefined;
@@ -386,6 +386,18 @@ bool constraintTerm_canGetValue (constraintTerm term)
     }
 }
 
+void constraintTerm_setValue (constraintTerm term, long value) 
+{
+  if (term->kind == CTT_INTLITERAL)
+    {
+      term->value.intlit = value;
+    }
+  else
+    {
+      BADBRANCH;
+    }
+}
+
 long constraintTerm_getValue (constraintTerm term) 
 {
   llassert (constraintTerm_canGetValue (term));
@@ -493,10 +505,16 @@ bool constraintTerm_similar (constraintTerm term1, constraintTerm term2)
 
       return (t1 == t2);
     }
-  
+
+        /*drl this if statement handles the case where constraintTerm_canGetValue only returns
+         true for term1 or term2 but no both
+         if constraintTerm_canGetValue returned tru for both we would have returned in the previous if statement
+         I suppose this could be done with xor but I've never used xor and don't feel like starting now
+         besides this way is more effecient.     
+       */
   if (constraintTerm_canGetValue (term1) || constraintTerm_canGetValue (term2))
     {
-      /* evans 2001-07-24: is this right? */ /*@i534@*/
+
       return FALSE;
     }
 
@@ -732,7 +750,6 @@ ctype constraintTerm_getCType (constraintTerm term)
       break;
 
     case CTT_INTLITERAL:
-      /*@i888*/ /* hack */
       ct = ctype_signedintegral;
       break;
       
This page took 0.03744 seconds and 4 git commands to generate.