summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asn1/ldap/packet-ldap-template.c2
-rw-r--r--epan/dfilter/gencode.c8
-rw-r--r--epan/dfilter/semcheck.c4
-rw-r--r--epan/dissectors/packet-http.c2
-rw-r--r--epan/dissectors/packet-imf.c2
-rw-r--r--epan/dissectors/packet-ldap.c2
-rw-r--r--epan/dissectors/packet-tpncp.c2
-rw-r--r--epan/dissectors/packet-xml.c2
-rw-r--r--epan/proto.c28
-rw-r--r--epan/proto.h5
-rw-r--r--epan/wslua/wslua_field.c3
-rw-r--r--epan/wspython/wspy_proto.c2
-rw-r--r--plugins/mate/mate_setup.c2
-rw-r--r--ui/gtk/filter_autocomplete.c2
-rw-r--r--ui/gtk/proto_hier_tree_model.c8
-rw-r--r--ui/gtk/supported_protos_dlg.c6
16 files changed, 44 insertions, 36 deletions
diff --git a/asn1/ldap/packet-ldap-template.c b/asn1/ldap/packet-ldap-template.c
index 83a7304a8a..a602a97540 100644
--- a/asn1/ldap/packet-ldap-template.c
+++ b/asn1/ldap/packet-ldap-template.c
@@ -515,7 +515,7 @@ attribute_types_initialize_cb(void)
hf[i].hfinfo.display = BASE_NONE;
hf[i].hfinfo.strings = NULL;
hf[i].hfinfo.blurb = g_strdup(attribute_types[i].attribute_desc);
- hf[i].hfinfo.same_name_prev = NULL;
+ hf[i].hfinfo.same_name_prev_id = -1;
hf[i].hfinfo.same_name_next = NULL;
g_hash_table_insert(attribute_types_hash, attribute_type, hf_id);
diff --git a/epan/dfilter/gencode.c b/epan/dfilter/gencode.c
index 8571d47a2b..f977c77ede 100644
--- a/epan/dfilter/gencode.c
+++ b/epan/dfilter/gencode.c
@@ -63,8 +63,8 @@ dfw_append_read_tree(dfwork_t *dfw, header_field_info *hfinfo)
gboolean added_new_hfinfo = FALSE;
/* Rewind to find the first field of this name. */
- while (hfinfo->same_name_prev) {
- hfinfo = hfinfo->same_name_prev;
+ while (hfinfo->same_name_prev_id != -1) {
+ hfinfo = proto_registrar_get_nth(hfinfo->same_name_prev_id);
}
/* Keep track of which registers
@@ -341,8 +341,8 @@ gen_test(dfwork_t *dfw, stnode_t *st_node)
hfinfo = (header_field_info*)stnode_data(st_arg1);
/* Rewind to find the first field of this name. */
- while (hfinfo->same_name_prev) {
- hfinfo = hfinfo->same_name_prev;
+ while (hfinfo->same_name_prev_id != -1) {
+ hfinfo = proto_registrar_get_nth(hfinfo->same_name_prev_id);
}
val1->value.hfinfo = hfinfo;
insn = dfvm_insn_new(CHECK_EXISTS);
diff --git a/epan/dfilter/semcheck.c b/epan/dfilter/semcheck.c
index ea5cb99e17..47dd748da3 100644
--- a/epan/dfilter/semcheck.c
+++ b/epan/dfilter/semcheck.c
@@ -618,8 +618,8 @@ check_relation_LHS_FIELD(const char *relation_string, FtypeCanFunc can_func,
}
if (!fvalue) {
/* Try another field with the same name */
- if (hfinfo1->same_name_prev) {
- hfinfo1 = hfinfo1->same_name_prev;
+ if (hfinfo1->same_name_prev_id != -1) {
+ hfinfo1 = proto_registrar_get_nth(hfinfo1->same_name_prev_id);
ftype1 = hfinfo1->type;
} else {
break;
diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c
index 17a4e3367f..b8fe8bf82f 100644
--- a/epan/dissectors/packet-http.c
+++ b/epan/dissectors/packet-http.c
@@ -2290,7 +2290,7 @@ header_fields_initialize_cb(void)
hf[i].hfinfo.display = BASE_NONE;
hf[i].hfinfo.strings = NULL;
hf[i].hfinfo.blurb = g_strdup(header_fields[i].header_desc);
- hf[i].hfinfo.same_name_prev = NULL;
+ hf[i].hfinfo.same_name_prev_id = -1;
hf[i].hfinfo.same_name_next = NULL;
g_hash_table_insert(header_fields_hash, header_name, hf_id);
diff --git a/epan/dissectors/packet-imf.c b/epan/dissectors/packet-imf.c
index 7056031b3c..2e26c3b6b8 100644
--- a/epan/dissectors/packet-imf.c
+++ b/epan/dissectors/packet-imf.c
@@ -895,7 +895,7 @@ header_fields_initialize_cb (void)
hf[i].hfinfo.display = BASE_NONE;
hf[i].hfinfo.strings = NULL;
hf[i].hfinfo.blurb = g_strdup (header_fields[i].description);
- hf[i].hfinfo.same_name_prev = NULL;
+ hf[i].hfinfo.same_name_prev_id = -1;
hf[i].hfinfo.same_name_next = NULL;
imffield = (struct imf_field *)g_malloc (sizeof (struct imf_field));
diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c
index a1b0dd6a12..1d9194e763 100644
--- a/epan/dissectors/packet-ldap.c
+++ b/epan/dissectors/packet-ldap.c
@@ -734,7 +734,7 @@ attribute_types_initialize_cb(void)
hf[i].hfinfo.display = BASE_NONE;
hf[i].hfinfo.strings = NULL;
hf[i].hfinfo.blurb = g_strdup(attribute_types[i].attribute_desc);
- hf[i].hfinfo.same_name_prev = NULL;
+ hf[i].hfinfo.same_name_prev_id = -1;
hf[i].hfinfo.same_name_next = NULL;
g_hash_table_insert(attribute_types_hash, attribute_type, hf_id);
diff --git a/epan/dissectors/packet-tpncp.c b/epan/dissectors/packet-tpncp.c
index e1ed09d0be..9248cf285e 100644
--- a/epan/dissectors/packet-tpncp.c
+++ b/epan/dissectors/packet-tpncp.c
@@ -584,7 +584,7 @@ static gint init_tpncp_data_fields_info(tpncp_data_field_info *data_fields_info,
hf_entr.hfinfo.parent = 0;
hf_entr.hfinfo.ref_type = HF_REF_TYPE_NONE;
hf_entr.hfinfo.same_name_next = NULL;
- hf_entr.hfinfo.same_name_prev = NULL;
+ hf_entr.hfinfo.same_name_prev_id = -1;
if (!was_registered) {
/* Register non-standard data should be done only once. */
diff --git a/epan/dissectors/packet-xml.c b/epan/dissectors/packet-xml.c
index 9569167b38..52617a6269 100644
--- a/epan/dissectors/packet-xml.c
+++ b/epan/dissectors/packet-xml.c
@@ -817,7 +817,7 @@ static void add_xml_field(wmem_array_t *hfs, int *p_id, const gchar *name, const
hfri.hfinfo.parent = 0;
hfri.hfinfo.ref_type = HF_REF_TYPE_NONE;
hfri.hfinfo.same_name_next = NULL;
- hfri.hfinfo.same_name_prev = NULL;
+ hfri.hfinfo.same_name_prev_id = -1;
wmem_array_append_one(hfs, hfri);
}
diff --git a/epan/proto.c b/epan/proto.c
index 03ee55fab6..08ae656dcd 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -3610,6 +3610,14 @@ protoo_strlcpy(gchar *dest, const gchar *src, gsize dest_size)
return (int) res;
}
+static header_field_info *
+hfinfo_same_name_get_prev(const header_field_info *hfinfo)
+{
+ if (hfinfo->same_name_prev_id == -1)
+ return NULL;
+ return proto_registrar_get_nth(hfinfo->same_name_prev_id);
+}
+
/* -------------------------- */
const gchar *
proto_custom_set(proto_tree* tree, const int field_id, gint occurrence,
@@ -3644,8 +3652,8 @@ proto_custom_set(proto_tree* tree, const int field_id, gint occurrence,
if (occurrence < 0) {
/* Search other direction */
- while (hfinfo->same_name_prev) {
- hfinfo = hfinfo->same_name_prev;
+ while (hfinfo->same_name_prev_id != -1) {
+ hfinfo = proto_registrar_get_nth(hfinfo->same_name_prev_id);
}
}
@@ -3656,7 +3664,7 @@ proto_custom_set(proto_tree* tree, const int field_id, gint occurrence,
if (occurrence < 0) {
hfinfo = hfinfo->same_name_next;
} else {
- hfinfo = hfinfo->same_name_prev;
+ hfinfo = hfinfo_same_name_get_prev(hfinfo);
}
continue;
}
@@ -3666,7 +3674,7 @@ proto_custom_set(proto_tree* tree, const int field_id, gint occurrence,
if (occurrence < 0) {
hfinfo = hfinfo->same_name_next;
} else {
- hfinfo = hfinfo->same_name_prev;
+ hfinfo = hfinfo_same_name_get_prev(hfinfo);
}
prev_len += len;
continue;
@@ -3917,7 +3925,7 @@ proto_custom_set(proto_tree* tree, const int field_id, gint occurrence,
if (occurrence == 0) {
/* Fetch next hfinfo with same name (abbrev) */
- hfinfo = hfinfo->same_name_prev;
+ hfinfo = hfinfo_same_name_get_prev(hfinfo);
} else {
hfinfo = NULL;
}
@@ -4959,7 +4967,7 @@ proto_register_field_init(header_field_info *hfinfo, const int parent)
hfinfo->parent = parent;
hfinfo->same_name_next = NULL;
- hfinfo->same_name_prev = NULL;
+ hfinfo->same_name_prev_id = -1;
/* if we always add and never delete, then id == len - 1 is correct */
if (gpa_hfinfo.len >= gpa_hfinfo.allocated_len) {
@@ -5018,10 +5026,10 @@ proto_register_field_init(header_field_info *hfinfo, const int parent)
hfinfo->same_name_next = same_name_next_hfinfo;
if (same_name_next_hfinfo)
- same_name_next_hfinfo->same_name_prev = hfinfo;
+ same_name_next_hfinfo->same_name_prev_id = hfinfo->id;
same_name_hfinfo->same_name_next = hfinfo;
- hfinfo->same_name_prev = same_name_hfinfo;
+ hfinfo->same_name_prev_id = same_name_hfinfo->id;
}
}
@@ -6111,7 +6119,7 @@ proto_registrar_dump_values(void)
* *maximum* length is 2 bytes, and be used
* for all lengths.)
*/
- if (hfinfo->same_name_prev != NULL)
+ if (hfinfo->same_name_prev_id != -1)
continue;
vals = NULL;
@@ -6286,7 +6294,7 @@ proto_registrar_dump_fields(void)
* *maximum* length is 2 bytes, and be used
* for all lengths.)
*/
- if (hfinfo->same_name_prev != NULL)
+ if (hfinfo->same_name_prev_id != -1)
continue;
PROTO_REGISTRAR_GET_NTH(hfinfo->parent, parent_hfinfo);
diff --git a/epan/proto.h b/epan/proto.h
index 8dfd85a05b..ee821185b1 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -373,9 +373,8 @@ struct _header_field_info {
int id; /**< Field ID */
int parent; /**< parent protocol tree */
hf_ref_type ref_type; /**< is this field referenced by a filter */
- /* 4B padding */
+ int same_name_prev_id; /**< ID of previous hfinfo with same abbrev */
header_field_info *same_name_next; /**< Link to next hfinfo with same abbrev */
- header_field_info *same_name_prev; /**< Link to previous hfinfo with same abbrev */
};
/**
@@ -383,7 +382,7 @@ struct _header_field_info {
* _header_field_info. If new fields are added or removed, it should
* be changed as necessary.
*/
-#define HFILL 0, 0, HF_REF_TYPE_NONE, NULL, NULL
+#define HFILL 0, 0, HF_REF_TYPE_NONE, -1, NULL
/** Used when registering many fields at once, using proto_register_field_array() */
typedef struct hf_register_info {
diff --git a/epan/wslua/wslua_field.c b/epan/wslua/wslua_field.c
index 242e32c202..f5fd6e9675 100644
--- a/epan/wslua/wslua_field.c
+++ b/epan/wslua/wslua_field.c
@@ -502,7 +502,7 @@ WSLUA_METAMETHOD Field__call (lua_State* L) {
WSLUA_ERROR(Field__call,"Fields cannot be used outside dissectors or taps");
}
- for (;in;in = in->same_name_prev) {
+ while (in) {
GPtrArray* found = proto_get_finfo_ptr_array(lua_tree->tree, in->id);
guint i;
if (found) {
@@ -511,6 +511,7 @@ WSLUA_METAMETHOD Field__call (lua_State* L) {
items_found++;
}
}
+ in = (in->same_name_prev_id != -1) ? proto_registrar_get_nth(in->same_name_prev_id) : NULL;
}
WSLUA_RETURN(items_found); /* All the values of this field */
diff --git a/epan/wspython/wspy_proto.c b/epan/wspython/wspy_proto.c
index e315a73e2a..d28b9526eb 100644
--- a/epan/wspython/wspy_proto.c
+++ b/epan/wspython/wspy_proto.c
@@ -70,7 +70,7 @@ void hf_register_info_add(hf_register_info *hf, guint8 index,
hf[index].hfinfo.parent = 0;
hf[index].hfinfo.ref_type = HF_REF_TYPE_NONE;
hf[index].hfinfo.same_name_next = NULL;
- hf[index].hfinfo.same_name_prev = NULL;
+ hf[index].hfinfo.same_name_prev_id = -1;
}
void hf_register_info_print(hf_register_info *hf, guint8 size)
diff --git a/plugins/mate/mate_setup.c b/plugins/mate/mate_setup.c
index e906aaa38b..bef204371e 100644
--- a/plugins/mate/mate_setup.c
+++ b/plugins/mate/mate_setup.c
@@ -156,7 +156,7 @@ extern gboolean add_hfid(header_field_info* hfi, gchar* how, GHashTable* where)
while(hfi) {
first_hfi = hfi;
- hfi = hfi->same_name_prev;
+ hfi = (hfi->same_name_prev_id != -1) ? proto_registrar_get_nth(hfi->same_name_prev_id) : NULL;
}
hfi = first_hfi;
diff --git a/ui/gtk/filter_autocomplete.c b/ui/gtk/filter_autocomplete.c
index 7cc92d2ea5..3513ba5075 100644
--- a/ui/gtk/filter_autocomplete.c
+++ b/ui/gtk/filter_autocomplete.c
@@ -661,7 +661,7 @@ build_autocompletion_list(GtkWidget *filter_te, GtkWidget *treeview, GtkWidget *
hfinfo != NULL;
hfinfo = proto_get_next_protocol_field(&cookie2))
{
- if (hfinfo->same_name_prev != NULL) /* ignore duplicate names */
+ if (hfinfo->same_name_prev_id != -1) /* ignore duplicate names */
continue;
if(!g_ascii_strncasecmp(protocol_name, hfinfo->abbrev, protocol_name_len)) {
diff --git a/ui/gtk/proto_hier_tree_model.c b/ui/gtk/proto_hier_tree_model.c
index d6616557ac..fb71c34afd 100644
--- a/ui/gtk/proto_hier_tree_model.c
+++ b/ui/gtk/proto_hier_tree_model.c
@@ -95,7 +95,7 @@ proto_hier_tree_iter_nth_child(GtkTreeModel *tree_model, GtkTreeIter *iter, GtkT
/* get n-th field of protocol */
hfinfo = proto_get_first_protocol_field(proto_id, &cookie);
while (hfinfo) {
- if (hfinfo->same_name_prev == NULL) {
+ if (hfinfo->same_name_prev_id == -1) {
if (!n)
break;
n--;
@@ -244,7 +244,7 @@ proto_hier_tree_iter_next(GtkTreeModel *tree_model, GtkTreeIter *iter)
hfinfo = proto_get_next_protocol_field(&cookie2);
/* get next field */
while (hfinfo) {
- if (hfinfo->same_name_prev == NULL)
+ if (hfinfo->same_name_prev_id == -1)
break;
hfinfo = proto_get_next_protocol_field(&cookie2);
}
@@ -292,7 +292,7 @@ proto_hier_tree_iter_n_children(GtkTreeModel *tree_model, GtkTreeIter *iter)
/* count not-duplicated fields */
for (hfinfo = proto_get_first_protocol_field(p_id, &cookie); hfinfo; hfinfo = proto_get_next_protocol_field(&cookie)) {
- if (hfinfo->same_name_prev)
+ if (hfinfo->same_name_prev_id != -1)
continue;
count++;
}
@@ -353,7 +353,7 @@ proto_hier_tree_get_path(GtkTreeModel *tree_model, GtkTreeIter *iter)
pos = 0;
for (hfinfo = proto_get_first_protocol_field(p_id, &cookie); hfinfo && hfinfo != iter->user_data3; hfinfo = proto_get_next_protocol_field(&cookie)) {
- if (hfinfo->same_name_prev)
+ if (hfinfo->same_name_prev_id != -1)
continue;
pos++;
}
diff --git a/ui/gtk/supported_protos_dlg.c b/ui/gtk/supported_protos_dlg.c
index 3d02666a46..ff325eb128 100644
--- a/ui/gtk/supported_protos_dlg.c
+++ b/ui/gtk/supported_protos_dlg.c
@@ -259,7 +259,7 @@ static void set_supported_text(GtkWidget *w, supported_type_t type)
for (hfinfo = proto_get_first_protocol_field(i, &cookie2); hfinfo != NULL;
hfinfo = proto_get_next_protocol_field(&cookie2)) {
- if (hfinfo->same_name_prev != NULL) /* ignore duplicate names */
+ if (hfinfo->same_name_prev_id != -1) /* ignore duplicate names */
continue;
if ((len = (int) strlen(hfinfo->abbrev)) > maxlen)
@@ -287,7 +287,7 @@ static void set_supported_text(GtkWidget *w, supported_type_t type)
for (hfinfo = proto_get_first_protocol_field(i, &cookie2); hfinfo != NULL;
hfinfo = proto_get_next_protocol_field(&cookie2)) {
- if (hfinfo->same_name_prev != NULL) /* ignore duplicate names */
+ if (hfinfo->same_name_prev_id != -1) /* ignore duplicate names */
continue;
count++;
}
@@ -300,7 +300,7 @@ static void set_supported_text(GtkWidget *w, supported_type_t type)
for (hfinfo = proto_get_first_protocol_field(i, &cookie2); hfinfo != NULL;
hfinfo = proto_get_next_protocol_field(&cookie2)) {
- if (hfinfo->same_name_prev != NULL) /* ignore duplicate names */
+ if (hfinfo->same_name_prev_id != -1) /* ignore duplicate names */
continue;
type_name = ftype_pretty_name(hfinfo->type);