Remove wtap_block_num_options_of_type().
authorGuy Harris <guy@alum.mit.edu>
Mon, 18 Jul 2016 19:46:40 +0000 (12:46 -0700)
committerGuy Harris <guy@alum.mit.edu>
Mon, 18 Jul 2016 19:47:35 +0000 (19:47 +0000)
It's not used; currently, everything that accesses instances of a
multiple-instance-allowed option do so in a loop that iterates over
option instances by fetching values of the Nth option until the attempt
to fetch the option fails, making only one pass over the options.

Change-Id: Ife9583a5d246027dbfc133ab58027ef6641d65ef
Reviewed-on: https://code.wireshark.org/review/16534
Reviewed-by: Guy Harris <guy@alum.mit.edu>
wiretap/wtap_opttypes.c

index c3b9f0df29e18e5a01809b77c78dec5d0164d7c5..0a76c390b8cfca75a8b1f211a588663166481a1b 100644 (file)
@@ -331,42 +331,6 @@ void wtap_block_foreach_option(wtap_block_t block, wtap_block_foreach_func func,
     }
 }
 
-wtap_opttype_return_val
-wtap_block_num_options_of_type(wtap_block_t block, guint option_id, guint *countp)
-{
-    guint n_options;
-    guint i;
-    wtap_option_t *opt;
-    wtap_opttype_t *opttype;
-
-    if (option_id >= block->info->options->len) {
-        /* There's no option for this block with that option ID */
-        return WTAP_OPTTYPE_NO_SUCH_OPTION;
-    }
-
-    opttype = &g_array_index(block->info->options, wtap_opttype_t, option_id);
-
-    /*
-     * Can there be more than one instance of this option?
-     */
-    if (!(opttype->flags & WTAP_OPTTYPE_FLAG_MULTIPLE_ALLOWED)) {
-        /*
-         * No; this is only for use with options with multiple
-         * instances.
-         */
-        return WTAP_OPTTYPE_NUMBER_MISMATCH;
-    }
-
-    n_options = 0;
-    for (i = 0; i < block->options->len; i++) {
-        opt = g_array_index(block->options, wtap_option_t*, i);
-        if (opt->option_id == option_id)
-            n_options++;
-    }
-    *countp = n_options;
-    return WTAP_OPTTYPE_SUCCESS;
-}
-
 static wtap_opttype_return_val
 wtap_block_add_option_common(wtap_block_t block, guint option_id, wtap_opttype_e type, wtap_option_t **optp)
 {