Fixed some calls to xcalloc where the quantity and size parameters had been transposed.
authorJohn Darrington <john@darrington.wattle.id.au>
Sun, 21 Jun 2020 11:21:03 +0000 (13:21 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sun, 21 Jun 2020 11:21:03 +0000 (13:21 +0200)
src/libpspp/bit-vector.c
src/math/categoricals.c
src/ui/gui/psppire-import-assistant.c

index 2b982915239a1f935ea13084393c0df32a258a56..79367248f0ae8653c9463709dc03c4702daa860e 100644 (file)
@@ -25,7 +25,8 @@
 unsigned long int *
 bitvector_allocate(size_t n)
 {
-  return xcalloc (sizeof (unsigned long int), DIV_RND_UP (n, BITS_PER_ULONG));
+  return xcalloc (DIV_RND_UP (n, BITS_PER_ULONG),
+                  sizeof (unsigned long int));
 }
 
 size_t
index eb28cb42bf50c5601f057c7b7930db63ff2aa9f2..7e949fc71804a34b9881b25ba84902696936f20f 100644 (file)
@@ -480,7 +480,7 @@ categoricals_done (const struct categoricals *cat_)
           return;
         }
 
-      struct value_node **nodes = xcalloc (sizeof *nodes, n_vals);
+      struct value_node **nodes = xcalloc (n_vals, sizeof *nodes);
       int x = 0;
       struct value_node *valnd;
       HMAP_FOR_EACH (valnd, struct value_node, node, &vn->valmap)
index ed8df0c9bc25a1362fae6e576bd9fb416ab73c08..88074bc7b7d5e6625ab5aac75235eeaa8382fe1d 100644 (file)
@@ -1241,7 +1241,7 @@ textfile_create_reader (PsppireImportAssistant *ia)
 
   int i;
 
-  struct fmt_guesser **fg = xcalloc (sizeof *fg, n_vars);
+  struct fmt_guesser **fg = xcalloc (n_vars, sizeof *fg);
   for (i = 0 ; i < n_vars; ++i)
     {
       fg[i] = fmt_guesser_create ();