sim: options: fix --help output
authorMike Frysinger <vapier@gentoo.org>
Sun, 2 May 2021 03:04:01 +0000 (23:04 -0400)
committerMike Frysinger <vapier@gentoo.org>
Sun, 2 May 2021 03:06:54 +0000 (23:06 -0400)
The hash table rewrite broke --help output due to subtle behavior:
calling dup_arg_p(NULL) will create & clear the table, not just
create it.  The --help output relies on this to clear the table
before it shows things.

sim/common/ChangeLog
sim/common/sim-options.c

index 55d684bfeab8a7efd195f0b4e88aa82289d38463..7abaeb3a81669078e7afe5093626dba9435872cf 100644 (file)
@@ -1,3 +1,7 @@
+2021-05-01  Mike Frysinger  <vapier@gentoo.org>
+
+       * sim-options.c (dup_arg_p): Call htab_empty.
+
 2021-05-01  Mike Frysinger  <vapier@gentoo.org>
 
        * dv-sockser.c (dv_sockser_install): Rename to ...
index a6da8eccdefaf39b3168418a3e5f7eaec5e9b234..1522cac9379fec0a998f00240052f6db1045fe7d 100644 (file)
@@ -437,6 +437,7 @@ dup_arg_p (const char *arg)
        arg_table = htab_create_alloc (10, htab_hash_string,
                                       compare_strings, NULL,
                                       xcalloc, free);
+      htab_empty (arg_table);
       return 0;
     }