forked from osmocom/wireshark
h248: convert GTree to wmem_tree.
Change-Id: Ia8d1a7ca4ce7e8754ab97ffe5f6e11181f08b264 Reviewed-on: https://code.wireshark.org/review/19905 Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
add6cb3976
commit
96b8da738d
|
@ -1493,7 +1493,7 @@ static const h248_pkg_param_t no_param = { 0, &hf_h248_param, h248_param_uint_it
|
|||
static const h248_pkg_evt_t no_event = { 0, &hf_h248_no_evt, &ett_h248_no_evt, NULL, NULL };
|
||||
|
||||
const h248_package_t *find_package_id(guint16 pkgid);
|
||||
static GTree* packages = NULL;
|
||||
static wmem_tree_t* packages = NULL;
|
||||
|
||||
extern void h248_param_PkgdName(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo , int hfid _U_, h248_curr_info_t* u1 _U_, void* u2 _U_) {
|
||||
tvbuff_t *new_tvb = NULL;
|
||||
|
@ -1627,7 +1627,7 @@ static int dissect_h248_ctx_id(gboolean implicit_tag, packet_info *pinfo, proto_
|
|||
|
||||
static s_h248_package_t *s_find_package_id(guint16 pkgid) {
|
||||
s_h248_package_t *s_pkg = NULL;
|
||||
s_pkg = (s_h248_package_t *)g_tree_lookup(packages, GUINT_TO_POINTER((guint32)(pkgid)));
|
||||
s_pkg = (s_h248_package_t *)wmem_tree_lookup32(packages, (guint32)(pkgid));
|
||||
return s_pkg;
|
||||
}
|
||||
|
||||
|
@ -1638,13 +1638,9 @@ const h248_package_t *find_package_id(guint16 pkgid) {
|
|||
return s_pkg->pkg;
|
||||
}
|
||||
|
||||
static gint32 comparePkgID(gconstpointer a, gconstpointer b) {
|
||||
return GPOINTER_TO_UINT(b) - GPOINTER_TO_UINT(a);
|
||||
}
|
||||
|
||||
static gboolean is_pkg_default(guint16 pkgid) {
|
||||
s_h248_package_t *s_pkg = NULL;
|
||||
s_pkg = (s_h248_package_t *)g_tree_lookup(packages, GUINT_TO_POINTER((guint32)(pkgid)));
|
||||
s_pkg = (s_h248_package_t *)wmem_tree_lookup32(packages, (guint32)(pkgid));
|
||||
if(! s_pkg ) return TRUE;
|
||||
return s_pkg->is_default;
|
||||
}
|
||||
|
@ -1658,7 +1654,7 @@ void h248_register_package(h248_package_t* pkg, pkg_reg_action reg_action) {
|
|||
if (! packages) {
|
||||
/* no packaegs are yet registerd so create tree and add default packages to tree
|
||||
*/
|
||||
packages = g_tree_new(comparePkgID); /* init tree if no entries */
|
||||
packages = wmem_tree_new(wmem_epan_scope()); /* init tree if no entries */
|
||||
while (base_package_name_vals[i].strptr != NULL) {
|
||||
pkg_found = wmem_new0(wmem_epan_scope(), h248_package_t); /* create a h248 package structure */
|
||||
pkg_found->id = base_package_name_vals[i].value;
|
||||
|
@ -1703,7 +1699,7 @@ void h248_register_package(h248_package_t* pkg, pkg_reg_action reg_action) {
|
|||
s_pkg = wmem_new0(wmem_epan_scope(), s_h248_package_t);
|
||||
s_pkg->is_default = TRUE;
|
||||
s_pkg->pkg = pkg_found;
|
||||
g_tree_insert(packages, GINT_TO_POINTER(pkg_found->id), (gpointer)s_pkg);
|
||||
wmem_tree_insert32(packages, pkg_found->id, s_pkg);
|
||||
i++;
|
||||
};
|
||||
pkg_found = NULL; /* reset pointer */
|
||||
|
@ -1714,7 +1710,7 @@ void h248_register_package(h248_package_t* pkg, pkg_reg_action reg_action) {
|
|||
s_pkg = wmem_new0(wmem_epan_scope(), s_h248_package_t);
|
||||
s_pkg->is_default = FALSE;
|
||||
s_pkg->pkg = (h248_package_t *)pkg;
|
||||
g_tree_replace(packages, GINT_TO_POINTER(pkg->id), (gpointer)s_pkg);
|
||||
wmem_tree_insert32(packages, pkg->id, s_pkg);
|
||||
return;
|
||||
};
|
||||
if(pkg_default) reg_action = MERGE_PKG_HIGH; /* always make new package overide default */
|
||||
|
@ -1723,7 +1719,7 @@ void h248_register_package(h248_package_t* pkg, pkg_reg_action reg_action) {
|
|||
s_pkg = wmem_new0(wmem_epan_scope(), s_h248_package_t);
|
||||
s_pkg->is_default = FALSE;
|
||||
s_pkg->pkg = (h248_package_t *)pkg;
|
||||
g_tree_insert(packages, GINT_TO_POINTER(pkg->id), (gpointer)s_pkg);
|
||||
wmem_tree_insert32(packages, pkg->id, s_pkg);
|
||||
return;
|
||||
}
|
||||
pkg_found = s_pkg->pkg;
|
||||
|
|
|
@ -1968,7 +1968,7 @@ static const h248_pkg_param_t no_param = { 0, &hf_h248_param, h248_param_uint_it
|
|||
static const h248_pkg_evt_t no_event = { 0, &hf_h248_no_evt, &ett_h248_no_evt, NULL, NULL };
|
||||
|
||||
const h248_package_t *find_package_id(guint16 pkgid);
|
||||
static GTree* packages = NULL;
|
||||
static wmem_tree_t* packages = NULL;
|
||||
|
||||
extern void h248_param_PkgdName(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo , int hfid _U_, h248_curr_info_t* u1 _U_, void* u2 _U_) {
|
||||
tvbuff_t *new_tvb = NULL;
|
||||
|
@ -2102,7 +2102,7 @@ static int dissect_h248_ctx_id(gboolean implicit_tag, packet_info *pinfo, proto_
|
|||
|
||||
static s_h248_package_t *s_find_package_id(guint16 pkgid) {
|
||||
s_h248_package_t *s_pkg = NULL;
|
||||
s_pkg = (s_h248_package_t *)g_tree_lookup(packages, GUINT_TO_POINTER((guint32)(pkgid)));
|
||||
s_pkg = (s_h248_package_t *)wmem_tree_lookup32(packages, (guint32)(pkgid));
|
||||
return s_pkg;
|
||||
}
|
||||
|
||||
|
@ -2113,13 +2113,9 @@ const h248_package_t *find_package_id(guint16 pkgid) {
|
|||
return s_pkg->pkg;
|
||||
}
|
||||
|
||||
static gint32 comparePkgID(gconstpointer a, gconstpointer b) {
|
||||
return GPOINTER_TO_UINT(b) - GPOINTER_TO_UINT(a);
|
||||
}
|
||||
|
||||
static gboolean is_pkg_default(guint16 pkgid) {
|
||||
s_h248_package_t *s_pkg = NULL;
|
||||
s_pkg = (s_h248_package_t *)g_tree_lookup(packages, GUINT_TO_POINTER((guint32)(pkgid)));
|
||||
s_pkg = (s_h248_package_t *)wmem_tree_lookup32(packages, (guint32)(pkgid));
|
||||
if(! s_pkg ) return TRUE;
|
||||
return s_pkg->is_default;
|
||||
}
|
||||
|
@ -2133,7 +2129,7 @@ void h248_register_package(h248_package_t* pkg, pkg_reg_action reg_action) {
|
|||
if (! packages) {
|
||||
/* no packaegs are yet registerd so create tree and add default packages to tree
|
||||
*/
|
||||
packages = g_tree_new(comparePkgID); /* init tree if no entries */
|
||||
packages = wmem_tree_new(wmem_epan_scope()); /* init tree if no entries */
|
||||
while (base_package_name_vals[i].strptr != NULL) {
|
||||
pkg_found = wmem_new0(wmem_epan_scope(), h248_package_t); /* create a h248 package structure */
|
||||
pkg_found->id = base_package_name_vals[i].value;
|
||||
|
@ -2178,7 +2174,7 @@ void h248_register_package(h248_package_t* pkg, pkg_reg_action reg_action) {
|
|||
s_pkg = wmem_new0(wmem_epan_scope(), s_h248_package_t);
|
||||
s_pkg->is_default = TRUE;
|
||||
s_pkg->pkg = pkg_found;
|
||||
g_tree_insert(packages, GINT_TO_POINTER(pkg_found->id), (gpointer)s_pkg);
|
||||
wmem_tree_insert32(packages, pkg_found->id, s_pkg);
|
||||
i++;
|
||||
};
|
||||
pkg_found = NULL; /* reset pointer */
|
||||
|
@ -2189,7 +2185,7 @@ void h248_register_package(h248_package_t* pkg, pkg_reg_action reg_action) {
|
|||
s_pkg = wmem_new0(wmem_epan_scope(), s_h248_package_t);
|
||||
s_pkg->is_default = FALSE;
|
||||
s_pkg->pkg = (h248_package_t *)pkg;
|
||||
g_tree_replace(packages, GINT_TO_POINTER(pkg->id), (gpointer)s_pkg);
|
||||
wmem_tree_insert32(packages, pkg->id, s_pkg);
|
||||
return;
|
||||
};
|
||||
if(pkg_default) reg_action = MERGE_PKG_HIGH; /* always make new package overide default */
|
||||
|
@ -2198,7 +2194,7 @@ void h248_register_package(h248_package_t* pkg, pkg_reg_action reg_action) {
|
|||
s_pkg = wmem_new0(wmem_epan_scope(), s_h248_package_t);
|
||||
s_pkg->is_default = FALSE;
|
||||
s_pkg->pkg = (h248_package_t *)pkg;
|
||||
g_tree_insert(packages, GINT_TO_POINTER(pkg->id), (gpointer)s_pkg);
|
||||
wmem_tree_insert32(packages, pkg->id, s_pkg);
|
||||
return;
|
||||
}
|
||||
pkg_found = s_pkg->pkg;
|
||||
|
@ -6086,7 +6082,7 @@ dissect_h248_SigParameterV1(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
|
|||
|
||||
|
||||
/*--- End of included file: packet-h248-fn.c ---*/
|
||||
#line 2164 "./asn1/h248/packet-h248-template.c"
|
||||
#line 2160 "./asn1/h248/packet-h248-template.c"
|
||||
|
||||
static int dissect_h248_tpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
|
||||
dissect_tpkt_encap(tvb, pinfo, tree, h248_desegment, h248_handle);
|
||||
|
@ -7511,7 +7507,7 @@ void proto_register_h248(void) {
|
|||
NULL, HFILL }},
|
||||
|
||||
/*--- End of included file: packet-h248-hfarr.c ---*/
|
||||
#line 2332 "./asn1/h248/packet-h248-template.c"
|
||||
#line 2328 "./asn1/h248/packet-h248-template.c"
|
||||
|
||||
GCP_HF_ARR_ELEMS("h248",h248_arrel)
|
||||
|
||||
|
@ -7677,7 +7673,7 @@ void proto_register_h248(void) {
|
|||
&ett_h248_SigParameterV1,
|
||||
|
||||
/*--- End of included file: packet-h248-ettarr.c ---*/
|
||||
#line 2350 "./asn1/h248/packet-h248-template.c"
|
||||
#line 2346 "./asn1/h248/packet-h248-template.c"
|
||||
};
|
||||
|
||||
static ei_register_info ei[] = {
|
||||
|
|
Loading…
Reference in New Issue