/*
** Splint - annotation-assisted static program checker
-** Copyright (C) 1994-2002 University of Virginia,
+** Copyright (C) 1994-2003 University of Virginia,
** Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
-** For information on splint: splint@cs.virginia.edu
-** To report a bug: splint-bug@cs.virginia.edu
+** For information on splint: info@splint.org
+** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
# include "splintMacros.nf"
# include "basic.h"
+
# undef malloc
# undef realloc
# undef calloc
# include "dmalloc.h"
# endif
-# include "portab.h"
+# include "osd.h"
/*
** redefine undef'd memory ops
{
if (size == 0)
{
- llbug (message ("Zero allocation at %q.",
- fileloc_unparseRaw (cstring_fromChars (name), line)));
+ llcontbug (message ("Zero allocation at %q.",
+ fileloc_unparseRaw (cstring_fromChars (name), line)));
+
+ /*
+ ** evans 2002-03-01
+ ** Return some allocated storage...hope we get lucky.
+ */
+
+ return dimalloc (16, name, line);
}
else
{
/*@=mustdefine@*/
-# ifndef NOLCL
-char *FormatInt (int i)
-{
- char temp[255]; /* assume the integer has at most 254 digits */
- char *outs;
-
- sprintf (temp, "%i", i);
- outs = (char *) dmalloc (sizeof (*outs) * (1 + strlen (temp)));
- strcpy (outs, temp);
-
- return (outs);
-}
-# endif
-
-# ifndef NOLCL
bool firstWord (char *s, char *w)
{
llassert (s != NULL);
}
return TRUE;
}
-# endif
void mstring_markFree (char *s)
{
}
extern
-char *mstring_create (int n)
+char *mstring_create (size_t n)
{
char *s;
return res;
}
+size_t size_fromLong (long x) /*@ensures result==x@*/
+{
+ size_t res = (size_t) x;
+
+ llassert ((long) res == x);
+ return res;
+}
+
+size_t size_fromLongUnsigned (unsigned long x) /*@ensures result==x@*/
+{
+ size_t res = (size_t) x;
+
+ llassert ((unsigned long) res == x);
+ return res;
+}
+
int size_toInt (size_t x)
{
int res = (int) x;