Ethereal-dev: Re: [Ethereal-dev] Adding list-type data to a column

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Thu, 5 Feb 2004 15:40:02 -0800

On Feb 5, 2004, at 3:32 PM, Olivier Biot wrote:

Should the check for the start of the column data be:
  if (cinfo->col_data[0]) {
    col_append_str(cinfo, el, separator ? separator : ", ");
  }
or should I use cinfo->col_buf[0] in the conditional addition of the
separator?

If you're appending to a column, then either the column was set by "col_set_str()", in which case the string pointed to by "col_data" has to be copied to "col_buf", or it wasn't set by "col_set_str()" or has subsequently be changed by another "col_" routine, in which case "col_data" just points to "col_buf".

That's handled by "COL_CHECK_APPEND()".

Therefore, it's just a matter of style; "col_append_str()" and "col_append_fstr()" use "col_buf", so I'd use "col_buf". (The idea is that you're updating the buffer.)