treewide: Replace <name>_cnt by n_<name>s and <name>_cap by allocated_<name>.
[pspp] / src / libpspp / ll.c
index e6533f2cd25fccf5beb2cbf9a4da31c279022027..887b58039e352e32fa2b0e5ee9b9be51be85f28f 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009, 2011 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -28,8 +28,8 @@
 #include <config.h>
 #endif
 
-#include <libpspp/ll.h>
-#include <assert.h>
+#include "libpspp/ll.h"
+
 
 /* Returns the number of nodes in LIST (not counting the null
    node).  Executes in O(n) time in the length of the list. */
@@ -121,7 +121,7 @@ ll_remove_equal (struct ll *r0, struct ll *r1, struct ll *target,
   size_t count;
 
   count = 0;
-  for (x = r0; x != r1; )
+  for (x = r0; x != r1;)
     if (compare (x, target, aux) == 0)
       {
         x = ll_remove (x);
@@ -144,7 +144,7 @@ ll_remove_if (struct ll *r0, struct ll *r1,
   size_t count;
 
   count = 0;
-  for (x = r0; x != r1; )
+  for (x = r0; x != r1;)
     if (predicate (x, aux))
       {
         x = ll_remove (x);
@@ -434,7 +434,7 @@ void
 ll_sort (struct ll *r0, struct ll *r1, ll_compare_func *compare, void *aux)
 {
   struct ll *pre_r0;
-  size_t output_run_cnt;
+  size_t output_run_len;
 
   if (r0 == r1 || ll_next (r0) == r1)
     return;
@@ -443,7 +443,7 @@ ll_sort (struct ll *r0, struct ll *r1, ll_compare_func *compare, void *aux)
   do
     {
       struct ll *a0 = ll_next (pre_r0);
-      for (output_run_cnt = 1; ; output_run_cnt++)
+      for (output_run_len = 1; ; output_run_len++)
         {
           struct ll *a1 = ll_find_run (a0, r1, compare, aux);
           struct ll *a2 = ll_find_run (a1, r1, compare, aux);
@@ -453,7 +453,7 @@ ll_sort (struct ll *r0, struct ll *r1, ll_compare_func *compare, void *aux)
           a0 = ll_merge (a0, a1, a1, a2, compare, aux);
         }
     }
-  while (output_run_cnt > 1);
+  while (output_run_len > 1);
 }
 
 /* Finds the extent of a run of nodes of increasing value