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
15 #include <wsutil/feature_list.h>
18 with_feature(feature_list l
, const char *fmt
, ...)
21 GString
*msg
= g_string_new("+");
23 g_string_append_vprintf(msg
, fmt
, arg
);
25 *l
= g_list_prepend(*l
, g_string_free(msg
, FALSE
));
29 without_feature(feature_list l
, const char *fmt
, ...)
32 GString
*msg
= g_string_new("-");
34 g_string_append_vprintf(msg
, fmt
, arg
);
36 *l
= g_list_prepend(*l
, g_string_free(msg
, FALSE
));
40 feature_sort_alpha(const void *a
, const void *b
)
42 return g_ascii_strcasecmp((char *)a
+ 1, (char *)b
+ 1);
46 sort_features(feature_list l
)
48 *l
= g_list_sort(*l
, feature_sort_alpha
);
52 free_features(feature_list l
)
54 g_list_free_full(*l
, g_free
);