From 252d55d80f92fa8267758fbf4faab520d2f79273 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 19 Nov 2000 08:54:37 +0000 Subject: For each column, have both a buffer into which strings for that column can be put, and a pointer to the string for the column, which might or might not point to that buffer. Add a routine "col_set_str()", which sets the string for the column to the string passed to it as an argument; it should only be handed a static string (a string constant would be ideal). It doesn't do any copying, so it's faster than "col_add_str()". Make the routines that append to columns check whether the pointer to the string for the column points to the buffer for the column and, if not, copy the string for the column to the buffer for the column so that you can append to it (so you can use "col_set_str()" and then use "col_append_str()" or "col_append_fstr()"). Convert a bunch of "col_add_str()" calls that take a string constant as an argument to "col_set_str()" calls. Convert some "col_add_fstr()" calls that take a string constant as the only argument - i.e., the format string doesn't have any "%" slots into which to put strings for subsequent arguments to "col_set_str()" calls (those calls are just like "col_add_str()" calls). Replace an END_OF_FRAME reference in a tvbuffified dissector with a "tvb_length(tvb)" call. svn path=/trunk/; revision=2670 --- packet-nbns.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'packet-nbns.c') diff --git a/packet-nbns.c b/packet-nbns.c index 9638543e8d..30c3f414bf 100644 --- a/packet-nbns.c +++ b/packet-nbns.c @@ -4,7 +4,7 @@ * Gilbert Ramirez * Much stuff added by Guy Harris * - * $Id: packet-nbns.c,v 1.46 2000/11/14 03:51:41 gram Exp $ + * $Id: packet-nbns.c,v 1.47 2000/11/19 08:54:00 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1138,11 +1138,11 @@ dissect_nbns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) nbns_data_offset = offset; if (check_col(fd, COL_PROTOCOL)) - col_add_str(fd, COL_PROTOCOL, "NBNS"); + col_set_str(fd, COL_PROTOCOL, "NBNS"); if (pi.captured_len < NBNS_HDRLEN) { if (check_col(fd, COL_INFO)) { - col_add_str(fd, COL_INFO, "Short NBNS packet"); + col_set_str(fd, COL_INFO, "Short NBNS packet"); } old_dissect_data(pd, offset, fd, tree); return; @@ -1325,7 +1325,7 @@ dissect_nbdgm(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) } if (check_col(fd, COL_PROTOCOL)) - col_add_str(fd, COL_PROTOCOL, "NBDS"); + col_set_str(fd, COL_PROTOCOL, "NBDS"); if (check_col(fd, COL_INFO)) { col_add_fstr(fd, COL_INFO, "%s", message[message_index]); } @@ -1635,7 +1635,7 @@ dissect_nbss(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) (memcmp(pd + offset + 4, "\377SMB", 4) != 0))) { if (check_col(fd, COL_PROTOCOL)) - col_add_str(fd, COL_PROTOCOL, "NBSS"); + col_set_str(fd, COL_PROTOCOL, "NBSS"); if (check_col(fd, COL_INFO)) { col_add_fstr(fd, COL_INFO, "NBSS Continuation Message"); } @@ -1648,7 +1648,7 @@ dissect_nbss(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) #endif if (check_col(fd, COL_PROTOCOL)) - col_add_str(fd, COL_PROTOCOL, "NBSS"); + col_set_str(fd, COL_PROTOCOL, "NBSS"); if (check_col(fd, COL_INFO)) { col_add_fstr(fd, COL_INFO, val_to_str(msg_type, message_types, "Unknown (%x)")); -- cgit v1.2.3