Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / libf2c / libF77 / F77_aloc.c
1 #include "f2c.h"
2 #undef abs
3 #undef min
4 #undef max
5 #include <stdio.h>
6
7 static integer memfailure = 3;
8
9 #ifdef KR_headers
10 extern char *malloc();
11 extern void G77_exit_0 ();
12
13  char *
14 F77_aloc(Len, whence) integer Len; char *whence;
15 #else
16 #include <stdlib.h>
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 extern void G77_exit_0 (integer*);
21 #ifdef __cplusplus
22         }
23 #endif
24
25  char *
26 F77_aloc(integer Len, char *whence)
27 #endif
28 {
29         char *rv;
30         unsigned int uLen = (unsigned int) Len; /* for K&R C */
31
32         if (!(rv = (char*)malloc(uLen))) {
33                 fprintf(stderr, "malloc(%u) failure in %s\n",
34                         uLen, whence);
35                 G77_exit_0 (&memfailure);
36                 }
37         return rv;
38         }