You should have received a copy of the GNU General Public License
along with GAS; see the file COPYING. If not, write to
- the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*
NAME
malloc()
*/
-#include <stdio.h>
-
-#if __STDC__ == 1
-#include <stdlib.h>
-#else
-#ifdef USG
-#include <malloc.h>
-#else
-char *malloc ();
-#endif /* USG */
-#endif /* not __STDC__ */
+
+#include "as.h"
#define error as_fatal
-char *
+PTR
xmalloc (n)
- long n;
+ unsigned long n;
{
- char *retval;
- void error ();
+ PTR retval;
- if ((retval = malloc ((unsigned) n)) == NULL)
- {
- error ("virtual memory exceeded");
- }
+ retval = malloc (n);
+ if (retval == NULL)
+ error ("virtual memory exceeded");
return (retval);
}
+PTR
+xrealloc (ptr, n)
+ register PTR ptr;
+ unsigned long n;
+{
+ ptr = realloc (ptr, n);
+ if (ptr == 0)
+ error ("virtual memory exceeded");
+ return (ptr);
+}
/* end of xmalloc.c */