File: PB_Cmalloc.c

package info (click to toggle)
scalapack 1.8.0-6
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 32,240 kB
  • ctags: 29,143
  • sloc: fortran: 288,069; ansic: 64,035; makefile: 1,911
file content (70 lines) | stat: -rw-r--r-- 1,627 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* ---------------------------------------------------------------------
*
*  -- PBLAS auxiliary routine (version 2.0) --
*     University of Tennessee, Knoxville, Oak Ridge National Laboratory,
*     and University of California, Berkeley.
*     April 1, 1998
*
*  ---------------------------------------------------------------------
*/
/*
*  Include files
*/
#include "../pblas.h"
#include "../PBpblas.h"
#include "../PBtools.h"
#include "../PBblacs.h"
#include "../PBblas.h"

#ifdef __STDC__
char * PB_Cmalloc( int LENGTH )
#else
char * PB_Cmalloc( LENGTH )
/*
*  .. Scalar Arguments ..
*/
   int            LENGTH;
#endif
{
/*
*  Purpose
*  =======
*
*  PB_Cmalloc allocates a dynamic memory buffer. In case of failure, the
*  program is stopped by calling Cblacs_abort.
*
*  Arguments
*  =========
*
*  LENGTH  (local input) INTEGER
*          On entry, LENGTH  specifies the length in bytes of the buffer
*          to be allocated.  If LENGTH is less or equal than zero,  this
*          function returns NULL.
*
*  -- Written on April 1, 1998 by
*     Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
*
*  ---------------------------------------------------------------------
*/
/*
*  .. Local Scalars ..
*/
   char           * bufptr = NULL;
/* ..
*  .. Executable Statements ..
*
*/
   if( LENGTH > 0 )
   {
      if( !( bufptr = (char *) malloc( (unsigned)LENGTH ) ) )
      {
         (void) fprintf( stderr, "Not enough memory on line %d of file %s!!\n",
                         __LINE__, __FILE__ );
         Cblacs_abort( -1, -1 );
      }
   }
   return( bufptr );
/*
*  End of PB_Cmalloc
*/
}