Don't include "inet_v6defs.h" in "column-utils.c"; nothing from it is
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 31 Jan 2002 00:51:36 +0000 (00:51 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 31 Jan 2002 00:51:36 +0000 (00:51 +0000)
necessary.

Don't use "alloca()", as it's not guaranteed to be present on all
platforms.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4644 f5534014-38df-0310-8fa8-9805f1628bb7

epan/column-utils.c

index 4052b1938540399b1d1451e04b1ad0a4567f7d9c..2a70eb4a0da48a433395859bad558a85f7cca45f 100644 (file)
@@ -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>
 # 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);
 }