]> andersk Git - splint.git/blobdiff - src/general.c
do..while control flow fix in exprNode.c
[splint.git] / src / general.c
index b819d0644867a63d65098bdc47cb39e8f73b2e49..c799195a156fcc224edcaa1ba81c59af8db05457 100644 (file)
@@ -42,7 +42,6 @@
 */
 
 # ifndef USEDMALLOC
-# include <stdlib.h> 
 
 /*@-mustdefine@*/
 
@@ -118,10 +117,17 @@ static long unsigned size_toLongUnsigned (size_t x)
        }
       else
        {
+         /* drl
+            fix this so message doesn't run out of
+            memory*/
+         
+         llbuglit("Out of memory");
+         
          llfatalerrorLoc
            (message ("Out of memory.  Allocating %w bytes at %s:%d.", 
                      size_toLongUnsigned (size),
                      cstring_fromChars (name), line));
+         
        }
     }
       
@@ -204,7 +210,7 @@ bool firstWord (char *s, char *w)
 
 void mstring_markFree (char *s)
 {
-    sfreeEventually (s);
+  sfreeEventually (s);
 }
 
 char *mstring_spaces (int n)
@@ -239,6 +245,18 @@ bool mstring_containsChar (const char *s, char c)
       return FALSE;
     }
 }
+
+bool mstring_containsString (const char *s, const char *c)
+{
+  if (mstring_isDefined (s))
+    {
+      return (strstr (s, c) != NULL);
+    }
+  else
+    {
+      return FALSE;
+    }
+}
  
 char *mstring_concat (const char *s1, const char *s2)
 {
@@ -387,9 +405,15 @@ long size_toLong (size_t x)
 char
 char_fromInt (int x)
 {
-  llassert ((x >= (int)'\0') && (x <= (int)'~'));
+  /*
+  ** evans 2001-09-28 - changed assertion in response to Anthony Giorgio's comment 
+  ** that the old assertions failed for EBCDIC character set.  Now we just check 
+  ** that the result is equal.
+  */
 
-  return ((char) x);
+  char res = (char) x;
+  llassert ((int) res == x);
+  return res;
 }
 
 /*@-czechfcns@*/
This page took 0.1143 seconds and 4 git commands to generate.