glib: Use g_slist_free_full() in a couple of places.
[metze/wireshark/wip.git] / epan / dfilter / sttype-set.c
1 /*
2  * Wireshark - Network traffic analyzer
3  * By Gerald Combs <gerald@wireshark.org>
4  * Copyright 2001 Gerald Combs
5  *
6  * SPDX-License-Identifier: GPL-2.0-or-later
7  */
8
9 #include "config.h"
10
11 #include "syntax-tree.h"
12 #include "sttype-set.h"
13
14 static void
15 slist_stnode_free(gpointer data)
16 {
17         stnode_free((stnode_t *)data);
18 }
19
20 void
21 set_nodelist_free(GSList *params)
22 {
23         g_slist_free_full(params, slist_stnode_free);
24 }
25
26 void
27 sttype_set_replace_element(stnode_t *node, stnode_t *oldnode, stnode_t *newnode)
28 {
29         GSList  *nodelist = (GSList*)stnode_data(node);
30
31         while (nodelist) {
32                 if (nodelist->data == oldnode) {
33                         nodelist->data = newnode;
34                         break;
35                 }
36                 nodelist = g_slist_next(nodelist);
37         }
38 }
39
40 void
41 sttype_register_set(void)
42 {
43         static sttype_t set_type = {
44                 STTYPE_SET,
45                 "SET",
46                 NULL,
47                 NULL,
48                 NULL
49         };
50
51         sttype_register(&set_type);
52 }
53
54 /*
55  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
56  *
57  * Local variables:
58  * c-basic-offset: 8
59  * tab-width: 8
60  * indent-tabs-mode: t
61  * End:
62  *
63  * vi: set shiftwidth=8 tabstop=8 noexpandtab:
64  * :indentSize=8:tabSize=8:noTabs=false:
65  */