aboutsummaryrefslogtreecommitdiffstats
path: root/epan/column-utils.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-04-19 04:04:12 -0700
committerEvan Huus <eapache@gmail.com>2014-04-19 14:20:06 +0000
commit80011ec03c034cbebbe901eb4ded1242efe8fc78 (patch)
treee10045f12229249b2e348fd8e288b6ecf6ad1074 /epan/column-utils.c
parent1d574597ec2dfed1ba7674866e8634d7f1ed988b (diff)
Don't se_ allocate strings when mapping addresses to column strings.
This should significantly reduce memory usage, without increasing the CPU time required to process a capture file in TShark or Wireshark. As a result, se_address_to_str() is no longer used; eliminate it. Fixes bug #9949. Change-Id: I65a112a426c82cc73a957b81384c765c3d14f2c3 Reviewed-on: https://code.wireshark.org/review/1213 Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan/column-utils.c')
-rw-r--r--epan/column-utils.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/epan/column-utils.c b/epan/column-utils.c
index 7f10c03f30..0bf6883160 100644
--- a/epan/column-utils.c
+++ b/epan/column-utils.c
@@ -1590,15 +1590,19 @@ static void
col_set_addr(packet_info *pinfo, const int col, const address *addr, const gboolean is_src,
const gboolean fill_col_exprs, const gboolean res)
{
+ const char *name;
+
if (addr->type == AT_NONE) {
/* No address, nothing to do */
return;
}
- if (res)
- pinfo->cinfo->col_data[col] = se_get_addr_name(addr);
- else
- pinfo->cinfo->col_data[col] = se_address_to_str(addr);
+ if (res && (name = se_get_addr_name(addr)) != NULL)
+ pinfo->cinfo->col_data[col] = name;
+ else {
+ pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
+ address_to_str_buf(addr, pinfo->cinfo->col_buf[col], COL_MAX_LEN);
+ }
if (!fill_col_exprs)
return;