]> Savannah Git Hosting - gnulib.git/commitdiff
bitset: style changes
authorAkim Demaille <akim.demaille@gmail.com>
Thu, 14 Mar 2019 07:31:54 +0000 (08:31 +0100)
committerAkim Demaille <akim.demaille@gmail.com>
Sun, 17 Mar 2019 07:35:08 +0000 (08:35 +0100)
* lib/bitset/table.c: Use NULL, not 0, for pointers.
Formatting changes.
(tbitset_list): Reduce scopes.

ChangeLog
lib/bitset/table.c

index ee12ff17d89f1ebf74d36cdf18beef0f78bd2dcf..a3fbce6e74de546c4a90f992ba214951648f088b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2019-03-14  Akim Demaille  <akim@lrde.epita.fr>
+
+       bitset: style changes.
+       * lib/bitset/table.c: Use NULL, not 0, for pointers.
+       Formatting changes.
+       (tbitset_list): Reduce scopes.
+
 2019-03-16  Bruno Haible  <bruno@clisp.org>
 
        fatal-signal: Pass the signal number to the action.
index 8351cf7848255cf8d0cb1732ada59d14b56dc0c7..a129c8712a3768c0011fe51aed3337297c15cde7 100644 (file)
@@ -300,7 +300,7 @@ tbitset_elt_find (bitset bset, bitset_bindex bindex,
       abort ();
 
     case EBITSET_FIND:
-      return 0;
+      return NULL;
 
     case EBITSET_CREATE:
       if (eindex >= size)
@@ -588,8 +588,8 @@ tbitset_list_reverse (bitset bset, bitset_bindex *list,
 
 
 /* Find list of up to NUM bits set in BSET starting from and including
- *NEXT and store in array LIST.  Return with actual number of bits
- found and with *NEXT indicating where search stopped.  */
  *NEXT and store in array LIST.  Return with actual number of bits
  found and with *NEXT indicating where search stopped.  */
 static bitset_bindex
 tbitset_list (bitset bset, bitset_bindex *list,
               bitset_bindex num, bitset_bindex *next)
@@ -607,17 +607,14 @@ tbitset_list (bitset bset, bitset_bindex *list,
   if (bitno % EBITSET_ELT_BITS)
     {
       /* We need to start within an element.  This is not very common.  */
-
       tbitset_elt *elt = elts[eindex];
       if (elt)
         {
-          bitset_windex woffset;
           bitset_word *srcp = EBITSET_WORDS (elt);
+          bitset_windex woffset = eindex * EBITSET_ELT_WORDS;
 
-          bitset_windex windex = bitno / BITSET_WORD_BITS;
-          woffset = eindex * EBITSET_ELT_WORDS;
-
-          for (; (windex - woffset) < EBITSET_ELT_WORDS; windex++)
+          for (bitset_windex windex = bitno / BITSET_WORD_BITS;
+               (windex - woffset) < EBITSET_ELT_WORDS; windex++)
             {
               bitset_word word = srcp[windex - woffset] >> (bitno % BITSET_WORD_BITS);