aboutsummaryrefslogtreecommitdiffstats
path: root/epan/address.h
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss.ws@gmail.com>2012-12-18 23:28:38 +0000
committerJeff Morriss <jeff.morriss.ws@gmail.com>2012-12-18 23:28:38 +0000
commit09221f45e4db2e2fb01fda57bc20e315a29c9838 (patch)
treebf96995ef321b637480790331254a15074e6b663 /epan/address.h
parent8b69e3ee22b83c24c81ccef64c1e73a503ce0bc0 (diff)
When copying addresses, also copy the (new) hf field.
Use SET_ADDRESS in some dissectors that weren't using it (so that the hf field is correctly initialized). Introduce a COPY_ADDRESS_SHALLOW (which copies an address without copying the contents of the data field). svn path=/trunk/; revision=46602
Diffstat (limited to 'epan/address.h')
-rw-r--r--epan/address.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/epan/address.h b/epan/address.h
index cf20d3c48c..c7b9959730 100644
--- a/epan/address.h
+++ b/epan/address.h
@@ -150,15 +150,26 @@ typedef struct _address {
guint8 *COPY_ADDRESS_data; \
(to)->type = (from)->type; \
(to)->len = (from)->len; \
+ (to)->hf = (from)->hf; \
COPY_ADDRESS_data = g_malloc((from)->len); \
memcpy(COPY_ADDRESS_data, (from)->data, (from)->len); \
(to)->data = COPY_ADDRESS_data; \
}
+/* Perform a shallow copy of the address (both addresses point to the same
+ * memory location).
+ */
+#define COPY_ADDRESS_SHALLOW(to, from) \
+ (to)->type = (from)->type; \
+ (to)->len = (from)->len; \
+ (to)->hf = (from)->hf; \
+ (to)->data = (from)->data;
+
#define SE_COPY_ADDRESS(to, from) { \
guint8 *SE_COPY_ADDRESS_data; \
(to)->type = (from)->type; \
(to)->len = (from)->len; \
+ (to)->hf = (from)->hf; \
SE_COPY_ADDRESS_data = se_alloc((from)->len); \
memcpy(SE_COPY_ADDRESS_data, (from)->data, (from)->len); \
(to)->data = SE_COPY_ADDRESS_data; \