]> git.draconx.ca Git - cdecl99.git/blobdiff - test/randomdecl.c
Plug memory leak in declgen.
[cdecl99.git] / test / randomdecl.c
index 8e404484648f56c6a0e8853e625ca5eca63eddef..9e9271e5b0ad12303a44dd3159641a090fc98b6f 100644 (file)
@@ -1,19 +1,19 @@
 /*
- *  Generate random C declarations for testing.
- *  Copyright © 2011 Nick Bowler
+ * Generate random C declarations for testing.
+ * Copyright © 2012, 2020, 2022 Nick Bowler
  *
- *  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
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
+ * 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
 #include <config.h>
@@ -54,11 +54,14 @@ static void print_usage(FILE *f)
 
 static void print_help(void)
 {
+       const struct option *opt;
+
        print_usage(stdout);
-       puts("Detailed help coming soon.");
+       puts("Generate random C declarations for testing.\n");
+       test_print_options(lopts);
 }
 
-static struct cdecl *random_decl(struct gen_rng *rng)
+static struct cdecl *random_decl(struct test_rng *rng)
 {
        struct cdecl *decl;
        unsigned flags = 0;
@@ -82,7 +85,7 @@ static struct cdecl *random_decl(struct gen_rng *rng)
 int main(int argc, char **argv)
 {
        const char *seed = "", *count_str = NULL;
-       struct gen_rng *rng;
+       struct test_rng *rng;
        struct cdecl *decl;
        unsigned long count = 0;
        int opt, mode = MODE_CDECL;
@@ -121,7 +124,7 @@ int main(int argc, char **argv)
                return EXIT_FAILURE;
        }
 
-       rng = gen_alloc_rng(seed);
+       rng = test_rng_alloc(seed);
        if (!rng)
                return EXIT_FAILURE;
 
@@ -139,7 +142,7 @@ int main(int argc, char **argv)
                free(decl);
        }
 
-       gen_free_rng(rng);
+       test_rng_free(rng);
 
        return EXIT_SUCCESS;
 }