aboutsummaryrefslogtreecommitdiffstats
path: root/epan/column-utils.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-01-31 00:51:36 +0000
committerGuy Harris <guy@alum.mit.edu>2002-01-31 00:51:36 +0000
commitb539bcadd578f356a2c641f77e63cc952d54e03e (patch)
treedcdf79dbf4a3ffbd99f13b78021dd489ba3497cd /epan/column-utils.c
parenta927aed2fb8cfe44e179367611cf370915b1768e (diff)
Don't include "inet_v6defs.h" in "column-utils.c"; nothing from it is
necessary. Don't use "alloca()", as it's not guaranteed to be present on all platforms. svn path=/trunk/; revision=4644
Diffstat (limited to 'epan/column-utils.c')
-rw-r--r--epan/column-utils.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/epan/column-utils.c b/epan/column-utils.c
index 4052b19385..2a70eb4a0d 100644
--- a/epan/column-utils.c
+++ b/epan/column-utils.c
@@ -1,7 +1,7 @@
/* column-utils.c
* Routines for column utilities.
*
- * $Id: column-utils.c,v 1.11 2002/01/29 08:44:49 guy Exp $
+ * $Id: column-utils.c,v 1.12 2002/01/31 00:51:36 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -37,10 +37,6 @@
# include "snprintf.h"
#endif
-#ifdef NEED_INET_V6DEFS_H
-# include "inet_v6defs.h"
-#endif
-
#include "column-utils.h"
#include "timestamp.h"
#include "sna-utils.h"
@@ -191,8 +187,9 @@ void
col_prepend_fstr(column_info *cinfo, gint el, gchar *format, ...)
{
va_list ap;
- int i, safe_orig = FALSE;
- char *orig = NULL;
+ int i;
+ char *orig_buf = NULL;
+ char *orig;
size_t max_len;
if (el == COL_INFO)
@@ -208,10 +205,9 @@ col_prepend_fstr(column_info *cinfo, gint el, gchar *format, ...)
orig = cinfo->col_data[i];
} else {
/* Need to cache the original string */
- if (!safe_orig) {
- orig = alloca(max_len);
- safe_orig = TRUE;
- }
+ if (orig_buf == NULL)
+ orig_buf = g_malloc(max_len);
+ orig = orig_buf;
strncpy(orig, cinfo->col_buf[i], max_len);
orig[max_len - 1] = '\0';
}
@@ -221,6 +217,8 @@ col_prepend_fstr(column_info *cinfo, gint el, gchar *format, ...)
cinfo->col_data[i] = cinfo->col_buf[i];
}
}
+ if (orig_buf != NULL)
+ g_free(orig_buf);
va_end(ap);
}