Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] rev 27554: /trunk/gtk/ /trunk/gtk/: rtp_
On Thu, Feb 26, 2009 at 11:39:11AM -0800, Guy Harris wrote:
>
> On Feb 26, 2009, at 8:46 AM, etxrab@xxxxxxxxxxxxx wrote:
>
> > http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=27554
> >
> > User: etxrab
> > Date: 2009/02/26 08:46 AM
> >
> > Log:
> > Another small performance boost.
> >
> > Directory: /trunk/gtk/
> > Changes Path Action
> > +17 -25 rtp_analysis.c Modified
>
> Another small performance boost that requires GTK+ 2.6 or later, as it
> introduces a call to gtk_list_store_insert_with_values().
Btw. We now don't need setlocate() o/ so maybe let's optimize more? :)
(Casting from gchar* to char* is IMHO not needed, but I'm leaving that)
Index: gtk/rtp_analysis.c
===================================================================
--- gtk/rtp_analysis.c (wersja 27554)
+++ gtk/rtp_analysis.c (kopia robocza)
@@ -2845,31 +2845,12 @@
/****************************************************************************/
/* append a line to list */
-#define RTP_FIELD_MAX 40
static void add_to_list(GtkWidget *list, user_data_t * user_data, guint32 number, guint16 seq_num,
double delta, double jitter, double bandwidth, gchar *status, gboolean marker,
gchar *timeStr, guint32 pkt_len, gchar *color_str, guint32 flags)
{
- gchar *data[3];
- gchar field[3][RTP_FIELD_MAX];
- char *savelocale;
GtkListStore *list_store;
- data[0]=&field[0][0];
- data[1]=&field[1][0];
- data[2]=&field[2][0];
-
- /* save the current locale */
- savelocale = setlocale(LC_NUMERIC, NULL);
- /* switch to "C" locale to avoid problems with localized decimal separators
- in g_snprintf("%f") functions */
- setlocale(LC_NUMERIC, "C");
- g_snprintf(field[0], RTP_FIELD_MAX, "%s", status);
- g_snprintf(field[1], RTP_FIELD_MAX, "%s", timeStr);
- g_snprintf(field[2], RTP_FIELD_MAX, "%s", color_str);
- /* restore previous locale setting */
- setlocale(LC_NUMERIC, savelocale);
-
if (strcmp(status, OK_TEXT) != 0) {
user_data->dlg.number_of_nok++;
}
@@ -2889,11 +2870,11 @@
JITTER_COLUMN, jitter,
IPBW_COLUMN, bandwidth,
MARKER_COLUMN, marker,
- STATUS_COLUMN, (char *)field[0],
- DATE_COLUMN, (char *)field[1],
+ STATUS_COLUMN, (char *)status,
+ DATE_COLUMN, (char *)timeStr,
LENGTH_COLUMN, pkt_len,
FOREGROUND_COLOR_COL, NULL,
- BACKGROUND_COLOR_COL, (char *)field[2],
+ BACKGROUND_COLOR_COL, (char *)color_str,
-1);
if(flags & STAT_FLAG_FIRST){