pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] Changes to pspp/src/sfm-read.c


From: Ben Pfaff
Subject: [Pspp-cvs] Changes to pspp/src/sfm-read.c
Date: Wed, 26 Oct 2005 01:07:44 -0400

Index: pspp/src/sfm-read.c
diff -u pspp/src/sfm-read.c:1.26 pspp/src/sfm-read.c:1.27
--- pspp/src/sfm-read.c:1.26    Tue Oct 25 04:28:17 2005
+++ pspp/src/sfm-read.c Wed Oct 26 05:06:14 2005
@@ -758,10 +758,10 @@
   *var_by_idx = 0;
 
   /* Pre-allocate variables. */
-  if ( r->value_cnt != -1 ) 
+  if (r->value_cnt != -1) 
     {
-      *var_by_idx = xmalloc(r->value_cnt * sizeof (**var_by_idx));
-      r->vars = xmalloc( r->value_cnt * sizeof (*r->vars) );
+      *var_by_idx = xnmalloc (r->value_cnt, sizeof **var_by_idx);
+      r->vars = xnmalloc (r->value_cnt, sizeof *r->vars);
     }
 
 
@@ -799,8 +799,8 @@
 
       if ( -1 == r->value_cnt ) 
        {
-         *var_by_idx = xrealloc (*var_by_idx, sizeof **var_by_idx * (i + 1));
-         r->vars = xrealloc(r->vars,  (i + 1) * sizeof (*r->vars) );
+         *var_by_idx = xnrealloc (*var_by_idx, i + 1, sizeof **var_by_idx);
+         r->vars = xnrealloc (r->vars, i + 1, sizeof *r->vars);
        }
 
       /* If there was a long string previously, make sure that the
@@ -1066,7 +1066,7 @@
     }
 
   /* Allocate memory. */
-  labels = xcalloc (n_labels ,  sizeof *labels);
+  labels = xcalloc (n_labels, sizeof *labels);
   for (i = 0; i < n_labels; i++)
     labels[i].label = NULL;
 
@@ -1118,7 +1118,7 @@
           handle_get_filename (r->fh), n_vars, dict_get_var_cnt (dict)));
 
   /* Read the list of variables. */
-  var = xmalloc (n_vars * sizeof *var);
+  var = xnmalloc (n_vars, sizeof *var);
   for (i = 0; i < n_vars; i++)
     {
       int32 var_idx;
@@ -1306,7 +1306,7 @@
   size_t amt;
 
   if (r->buf == NULL)
-    r->buf = xmalloc (sizeof *r->buf * 128);
+    r->buf = xnmalloc (128, sizeof *r->buf);
   amt = fread (r->buf, sizeof *r->buf, 128, r->file);
   if (ferror (r->file))
     {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]