Revert "UNUSED enc_key_id_{equal,hash}"
[wireshark-sm.git] / wsutil / feature_list.c
blobc06a453e9c8674adbcded5071b67b4d50708cd06
1 /* feature_list.c
2 * Routines for gathering and handling lists of present/absent features
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
11 #include <stdbool.h>
13 #include "config.h"
15 #include <wsutil/feature_list.h>
17 void
18 with_feature(feature_list l, const char *fmt, ...)
20 va_list arg;
21 GString *msg = g_string_new("+");
22 va_start(arg, fmt);
23 g_string_append_vprintf(msg, fmt, arg);
24 va_end(arg);
25 *l = g_list_prepend(*l, g_string_free(msg, FALSE));
28 void
29 without_feature(feature_list l, const char *fmt, ...)
31 va_list arg;
32 GString *msg = g_string_new("-");
33 va_start(arg, fmt);
34 g_string_append_vprintf(msg, fmt, arg);
35 va_end(arg);
36 *l = g_list_prepend(*l, g_string_free(msg, FALSE));
39 static int
40 feature_sort_alpha(const void *a, const void *b)
42 return g_ascii_strcasecmp((char *)a + 1, (char *)b + 1);
45 void
46 sort_features(feature_list l)
48 *l = g_list_sort(*l, feature_sort_alpha);
51 void
52 free_features(feature_list l)
54 g_list_free_full(*l, g_free);
55 *l = NULL;