/[pspp]/pspp/src/subclist.c
ViewVC logotype

Diff of /pspp/src/subclist.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by jmd, Fri Apr 29 01:02:15 2005 UTC revision 1.4 by blp, Wed Oct 26 05:06:14 2005 UTC
# Line 23  Foundation, Inc., 51 Franklin Street, Fi Line 23  Foundation, Inc., 51 Franklin Street, Fi
23    
24  #include "subclist.h"  #include "subclist.h"
25  #include <stdlib.h>  #include <stdlib.h>
26    #include "xalloc.h"
27    
28  /* I call these objects `lists' but they are in fact simple dynamic arrays */  /* I call these objects `lists' but they are in fact simple dynamic arrays */
29    
# Line 32  Foundation, Inc., 51 Franklin Street, Fi Line 33  Foundation, Inc., 51 Franklin Street, Fi
33  void  void
34  subc_list_double_create(subc_list_double *l)  subc_list_double_create(subc_list_double *l)
35  {  {
36    l->data = (double *) malloc(CHUNKSIZE * sizeof (double));    l->data = xnmalloc (CHUNKSIZE, sizeof *l->data);
37    l->sz = CHUNKSIZE;    l->sz = CHUNKSIZE;
38    l->n_data = 0;    l->n_data = 0;
39  }  }
# Line 46  subc_list_double_push(subc_list_double * Line 47  subc_list_double_push(subc_list_double *
47    if (l->n_data >= l->sz )    if (l->n_data >= l->sz )
48      {      {
49        l->sz += CHUNKSIZE;        l->sz += CHUNKSIZE;
50        l->data = realloc(l->data, l->sz * sizeof(double));        l->data = xnrealloc (l->data, l->sz, sizeof *l->data);
51      }      }
52    
53  }  }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26