diff options
author | Kovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com> | 2009-09-22 21:08:48 +0000 |
---|---|---|
committer | Kovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com> | 2009-09-22 21:08:48 +0000 |
commit | a05517fd21e64ace87b86d741ee83ece90fbcbfc (patch) | |
tree | a8246adf32db0617b04084b6cb42941f3423477e | |
parent | 5bbec764db30a8fed3dabe62a8ca6e2c5f51af63 (diff) |
(Cosmetic) Reorder functions
svn path=/trunk/; revision=30081
-rw-r--r-- | epan/column-utils.c | 188 |
1 files changed, 94 insertions, 94 deletions
diff --git a/epan/column-utils.c b/epan/column-utils.c index cc3d81816b..b61d5de78d 100644 --- a/epan/column-utils.c +++ b/epan/column-utils.c @@ -198,89 +198,6 @@ col_clear(column_info *cinfo, gint el) return; \ } -/* Use this if "str" points to something that will stay around (and thus - needn't be copied). */ -void -col_set_str(column_info *cinfo, gint el, const gchar* str) -{ - int i; - int fence; - size_t max_len; - - DISSECTOR_ASSERT(str); - - /* The caller is expected to pass in something that 'will stay around' and - * something from the ephemeral pool certainly doesn't fit the bill. */ - DISSECTOR_ASSERT(!ep_verify_pointer(str)); - - if (!CHECK_COL(cinfo, el)) - return; - - if (el == COL_INFO) - max_len = COL_MAX_INFO_LEN; - else - max_len = COL_MAX_LEN; - - for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) { - if (cinfo->fmt_matx[i][el]) { - fence = cinfo->col_fence[i]; - if (fence != 0) { - /* - * We will append the string after the fence. - * First arrange that we can append, if necessary. - */ - COL_CHECK_APPEND(cinfo, i, max_len); - - g_strlcpy(&cinfo->col_buf[i][fence], str, max_len - fence); - } else { - /* - * There's no fence, so we can just set the column to point - * to the string. - */ - cinfo->col_data[i] = str; - } - } - } -} - -/* Adds a vararg list to a packet info string. */ -void -col_add_fstr(column_info *cinfo, gint el, const gchar *format, ...) { - va_list ap; - int i; - int fence; - int max_len; - - if (!CHECK_COL(cinfo, el)) - return; - - if (el == COL_INFO) - max_len = COL_MAX_INFO_LEN; - else - max_len = COL_MAX_LEN; - - va_start(ap, format); - for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) { - if (cinfo->fmt_matx[i][el]) { - fence = cinfo->col_fence[i]; - if (fence != 0) { - /* - * We will append the string after the fence. - * First arrange that we can append, if necessary. - */ - COL_CHECK_APPEND(cinfo, i, max_len); - } else { - /* - * There's no fence, so we can just write to the string. - */ - cinfo->col_data[i] = cinfo->col_buf[i]; - } - g_vsnprintf(&cinfo->col_buf[i][fence], max_len - fence, format, ap); - } - } - va_end(ap); -} - /* The same as CHECK_COL(), but without the check to see if the column is writable. */ #define HAVE_CUSTOM_COLS(cinfo) ((cinfo) && (cinfo)->col_first[COL_CUSTOM] >= 0) @@ -336,17 +253,6 @@ col_custom_prime_edt(epan_dissect_t *edt, column_info *cinfo) } } -gboolean -col_has_time_fmt(column_info *cinfo, gint col) -{ - return ((cinfo->fmt_matx[col][COL_CLS_TIME]) || - (cinfo->fmt_matx[col][COL_ABS_TIME]) || - (cinfo->fmt_matx[col][COL_ABS_DATE_TIME]) || - (cinfo->fmt_matx[col][COL_REL_TIME]) || - (cinfo->fmt_matx[col][COL_DELTA_TIME]) || - (cinfo->fmt_matx[col][COL_DELTA_TIME_DIS])); -} - static void col_do_append_sep_va_fstr(column_info *cinfo, gint el, const gchar *separator, const gchar *format, va_list ap) @@ -549,6 +455,89 @@ col_add_str(column_info *cinfo, gint el, const gchar* str) } } +/* Use this if "str" points to something that will stay around (and thus + needn't be copied). */ +void +col_set_str(column_info *cinfo, gint el, const gchar* str) +{ + int i; + int fence; + size_t max_len; + + DISSECTOR_ASSERT(str); + + /* The caller is expected to pass in something that 'will stay around' and + * something from the ephemeral pool certainly doesn't fit the bill. */ + DISSECTOR_ASSERT(!ep_verify_pointer(str)); + + if (!CHECK_COL(cinfo, el)) + return; + + if (el == COL_INFO) + max_len = COL_MAX_INFO_LEN; + else + max_len = COL_MAX_LEN; + + for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) { + if (cinfo->fmt_matx[i][el]) { + fence = cinfo->col_fence[i]; + if (fence != 0) { + /* + * We will append the string after the fence. + * First arrange that we can append, if necessary. + */ + COL_CHECK_APPEND(cinfo, i, max_len); + + g_strlcpy(&cinfo->col_buf[i][fence], str, max_len - fence); + } else { + /* + * There's no fence, so we can just set the column to point + * to the string. + */ + cinfo->col_data[i] = str; + } + } + } +} + +/* Adds a vararg list to a packet info string. */ +void +col_add_fstr(column_info *cinfo, gint el, const gchar *format, ...) { + va_list ap; + int i; + int fence; + int max_len; + + if (!CHECK_COL(cinfo, el)) + return; + + if (el == COL_INFO) + max_len = COL_MAX_INFO_LEN; + else + max_len = COL_MAX_LEN; + + va_start(ap, format); + for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) { + if (cinfo->fmt_matx[i][el]) { + fence = cinfo->col_fence[i]; + if (fence != 0) { + /* + * We will append the string after the fence. + * First arrange that we can append, if necessary. + */ + COL_CHECK_APPEND(cinfo, i, max_len); + } else { + /* + * There's no fence, so we can just write to the string. + */ + cinfo->col_data[i] = cinfo->col_buf[i]; + } + g_vsnprintf(&cinfo->col_buf[i][fence], max_len - fence, format, ap); + } + } + va_end(ap); +} + static void col_do_append_str(column_info *cinfo, gint el, const gchar* separator, const gchar* str) @@ -611,6 +600,17 @@ col_append_sep_str(column_info *cinfo, gint el, const gchar* separator, } /* --------------------------------- */ +gboolean +col_has_time_fmt(column_info *cinfo, gint col) +{ + return ((cinfo->fmt_matx[col][COL_CLS_TIME]) || + (cinfo->fmt_matx[col][COL_ABS_TIME]) || + (cinfo->fmt_matx[col][COL_ABS_DATE_TIME]) || + (cinfo->fmt_matx[col][COL_REL_TIME]) || + (cinfo->fmt_matx[col][COL_DELTA_TIME]) || + (cinfo->fmt_matx[col][COL_DELTA_TIME_DIS])); +} + static gint set_abs_date_time(frame_data *fd, gchar *buf) { |