ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
PB_Cmalloc.c
Go to the documentation of this file.
1 /* ---------------------------------------------------------------------
2 *
3 * -- PBLAS auxiliary routine (version 2.0) --
4 * University of Tennessee, Knoxville, Oak Ridge National Laboratory,
5 * and University of California, Berkeley.
6 * April 1, 1998
7 *
8 * ---------------------------------------------------------------------
9 */
10 /*
11 * Include files
12 */
13 #include "../pblas.h"
14 #include "../PBpblas.h"
15 #include "../PBtools.h"
16 #include "../PBblacs.h"
17 #include "../PBblas.h"
18 
19 #ifdef __STDC__
20 char * PB_Cmalloc( int LENGTH )
21 #else
22 char * PB_Cmalloc( LENGTH )
23 /*
24 * .. Scalar Arguments ..
25 */
26  int LENGTH;
27 #endif
28 {
29 /*
30 * Purpose
31 * =======
32 *
33 * PB_Cmalloc allocates a dynamic memory buffer. In case of failure, the
34 * program is stopped by calling Cblacs_abort.
35 *
36 * Arguments
37 * =========
38 *
39 * LENGTH (local input) INTEGER
40 * On entry, LENGTH specifies the length in bytes of the buffer
41 * to be allocated. If LENGTH is less or equal than zero, this
42 * function returns NULL.
43 *
44 * -- Written on April 1, 1998 by
45 * Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
46 *
47 * ---------------------------------------------------------------------
48 */
49 /*
50 * .. Local Scalars ..
51 */
52  char * bufptr = NULL;
53 /* ..
54 * .. Executable Statements ..
55 *
56 */
57  if( LENGTH > 0 )
58  {
59  if( !( bufptr = (char *) malloc( (unsigned)LENGTH ) ) )
60  {
61  (void) fprintf( stderr, "Not enough memory on line %d of file %s!!\n",
62  __LINE__, __FILE__ );
63  Cblacs_abort( -1, -1 );
64  }
65  }
66  return( bufptr );
67 /*
68 * End of PB_Cmalloc
69 */
70 }
Cblacs_abort
void Cblacs_abort()
PB_Cmalloc
char * PB_Cmalloc(int LENGTH)
Definition: PB_Cmalloc.c:22