]> git.ozlabs.org Git - ccan/commitdiff
jbitset: fix examples, remove test memory leak.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 23 Aug 2011 02:06:49 +0000 (11:36 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 23 Aug 2011 02:06:49 +0000 (11:36 +0930)
ccan/jbitset/jbitset.h
ccan/jbitset/test/run-type.c

index 6da79d77a7cadb952b9cee2782c2238f4ea09d8c..acac2a76526d5ed64b26a9126cc098b00b51dd4e 100644 (file)
@@ -156,7 +156,7 @@ static inline unsigned long jbit_popcount(const struct jbitset *set,
  *     assert(!jbit_test(set, 0));
  *     for (i = 0; (val = jbit_nth(set, i, 0)) != 0; i++) {
  *             assert(jbit_popcount(set, 0, val) == i);
  *     assert(!jbit_test(set, 0));
  *     for (i = 0; (val = jbit_nth(set, i, 0)) != 0; i++) {
  *             assert(jbit_popcount(set, 0, val) == i);
- *             printf("Value %zu = %zu\n", i, val);
+ *             printf("Value %lu = %lu\n", i, val);
  *     }
  */
 static inline unsigned long jbit_nth(const struct jbitset *set,
  *     }
  */
 static inline unsigned long jbit_nth(const struct jbitset *set,
@@ -179,7 +179,7 @@ static inline unsigned long jbit_nth(const struct jbitset *set,
  *     assert(!jbit_test(set, 0));
  *     printf("Set contents (increasing order):");
  *     for (i = jbit_first(set, 0); i; i = jbit_next(set, i, 0))
  *     assert(!jbit_test(set, 0));
  *     printf("Set contents (increasing order):");
  *     for (i = jbit_first(set, 0); i; i = jbit_next(set, i, 0))
- *             printf(" %zu", i);
+ *             printf(" %lu", i);
  *     printf("\n");
  */
 static inline unsigned long jbit_first(const struct jbitset *set,
  *     printf("\n");
  */
 static inline unsigned long jbit_first(const struct jbitset *set,
@@ -222,7 +222,7 @@ static inline unsigned long jbit_next(const struct jbitset *set,
  *     assert(!jbit_test(set, 0));
  *     printf("Set contents (decreasing order):");
  *     for (i = jbit_last(set, 0); i; i = jbit_prev(set, i, 0))
  *     assert(!jbit_test(set, 0));
  *     printf("Set contents (decreasing order):");
  *     for (i = jbit_last(set, 0); i; i = jbit_prev(set, i, 0))
- *             printf(" %zu", i);
+ *             printf(" %lu", i);
  *     printf("\n");
  */
 static inline unsigned long jbit_last(const struct jbitset *set,
  *     printf("\n");
  */
 static inline unsigned long jbit_last(const struct jbitset *set,
index 1eefb42350d8fed978cde92e6e6fee4ac209f72a..47c5bfb28185e1ee7830050d69ed1b51790fbc25 100644 (file)
@@ -53,5 +53,8 @@ int main(int argc, char *argv[])
        ok1(jbit_foo_error(set) == NULL);
        jbit_foo_free(set);
 
        ok1(jbit_foo_error(set) == NULL);
        jbit_foo_free(set);
 
+       for (i = 0; i < NUM; i++)
+               free(foo[i]);
+
        return exit_status();
 }
        return exit_status();
 }