~ubuntu-branches/ubuntu/quantal/psicode/quantal

« back to all changes in this revision

Viewing changes to src/lib/libciomr/init_ptrs.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2006-09-10 14:01:33 UTC
  • Revision ID: james.westby@ubuntu.com-20060910140133-ib2j86trekykfsfv
Tags: upstream-3.2.3
ImportĀ upstreamĀ versionĀ 3.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/* $Log: init_ptrs.c,v $
 
3
/* Revision 1.4  2003/05/22 06:20:06  crawdad
 
4
/* Corrected most of the libraries and modules to use proper PSI_RETURN_XX
 
5
/* values from psifiles.h.  Modified ccdensity, ccenergy, cchbar, cclambda,
 
6
/* ccsort, cctriples, cis, cphf, cusp, localize, stable, libchkpt, libciomr,
 
7
/* libdpd, libipv1, libpsio, libqt, and tocprint.
 
8
/* -TDC
 
9
/*
 
10
/* Revision 1.3  2002/06/24 01:02:26  crawdad
 
11
/* Various changes.  (1) Added new function to libdpd: buf4_sort_axpy(), which
 
12
/* will perform a sort and axpy at the same time.  Convenient for many
 
13
/* things.  (2) Added a new sort to all buf4_sort* functions.  (3) Some
 
14
/* documentation changes.
 
15
/* -TDC
 
16
/*
 
17
/* Revision 1.2  2001/08/28 18:42:44  crawdad
 
18
/* Minor changes associated with memory-leak tracking.
 
19
/* -TDC
 
20
/*
 
21
/* Revision 1.1.1.1  2000/02/04 22:53:19  evaleev
 
22
/* Started PSI 3 repository
 
23
/*
 
24
/* Revision 2.7  1997/09/23 12:53:33  crawdad
 
25
/* Correcting nasty, hideous, stupied little bug that annoyed me for a week.
 
26
/*
 
27
 * Revision 2.6  1997/09/12  13:52:50  crawdad
 
28
 * Changing marco name from ULL to PSI_FPTR.
 
29
 *
 
30
 * Revision 2.5  1997/08/25  21:49:52  crawdad
 
31
 * Making changes for extension of PSI file size limit.
 
32
 *
 
33
 * Revision 2.4  1997/06/23  12:25:48  crawdad
 
34
 * Multiple changes to libciomr: Moved "param.h" to "iomrparam.h" to avoid
 
35
 *     conflicts with similarly named system file under linux.  Corrected type
 
36
 *    casting in rread(), rwrit(), sread(), and swrit() functions.  Corrected
 
37
 *     unclosed tmpdisks.dat file in sequential.c.  Corrected block_matrix() to
 
38
 *    avoid malloc'ing zero-length arrays.
 
39
 *
 
40
 * -Daniel
 
41
 *
 
42
 * Revision 2.3  1996/07/03  11:26:38  psi
 
43
 * Added free_ptrs() function in init_ptrs.c.  Added free() calls to tstart()
 
44
 * and tstop().
 
45
 *
 
46
 * Revision 2.2  1996/07/02 21:06:29  sherrill
 
47
 * Completed the changes needed to use unit numbers greater than 99; changed
 
48
 * a hardwired 99 in init_ptrs.c to MAX_UNIT and increased a "unit" string
 
49
 * from 3 chars to 4.  Also removed a compiler warning in sequential.c by
 
50
 * casting ud to (char *) for malloc_check().
 
51
 *
 
52
 * Revision 2.1  1991/06/15  18:29:21  seidl
 
53
 * *** empty log message ***
 
54
 * */
 
55
 
 
56
static char *rcsid = "$Id: init_ptrs.c,v 1.4 2003/05/22 06:20:06 crawdad Exp $";
 
57
 
 
58
#include <psifiles.h>
 
59
#include "iomrparam.h"
 
60
#include "includes.h"
 
61
#include "pointers.h"
 
62
 
 
63
/* allocates memory for array of file pointers */
 
64
 
 
65
void init_ptrs(void)
 
66
{
 
67
  int num_ptrs = MAX_UNIT;
 
68
 
 
69
  ptr.wptr = (PSI_FPTR *) malloc(sizeof(PSI_FPTR)*num_ptrs);
 
70
 
 
71
  if (ptr.wptr == NULL) {
 
72
    fprintf(stderr,"trouble allocating memory for pointers!\n");
 
73
    exit(PSI_RETURN_FAILURE);
 
74
  }
 
75
}
 
76
 
 
77
void free_ptrs(void)
 
78
{
 
79
  free(ptr.wptr);
 
80
}