From 71c1e4faf015c565e543b78b7324b6eb6d528f07 Mon Sep 17 00:00:00 2001 From: Jeff Morriss Date: Fri, 11 Jul 2008 21:13:39 +0000 Subject: Change the stats tree API to use signed chars instead of guint8s for all its strings; this should fix a number of signed/unsigned char warnings. Reindent a bunch, too. svn path=/trunk/; revision=25716 --- epan/stats_tree_priv.h | 90 +++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 45 deletions(-) (limited to 'epan/stats_tree_priv.h') diff --git a/epan/stats_tree_priv.h b/epan/stats_tree_priv.h index b6688e028f..5c4a2d3c75 100644 --- a/epan/stats_tree_priv.h +++ b/epan/stats_tree_priv.h @@ -54,34 +54,34 @@ typedef struct _range_pair { struct _stat_node { gchar* name; - int id; + int id; /* the counter it keeps */ gint counter; /* children nodes by name */ - GHashTable* hash; + GHashTable *hash; /* the owner of this node */ - stats_tree* st; + stats_tree *st; /* relatives */ - stat_node* parent; - stat_node* children; - stat_node* next; + stat_node *parent; + stat_node *children; + stat_node *next; /* used to check if value is within range */ - range_pair_t* rng; + range_pair_t *rng; /* node presentation data */ - st_node_pres* pr; + st_node_pres *pr; }; struct _stats_tree { /* the "class" from which it's derived */ - stats_tree_cfg* cfg; + stats_tree_cfg *cfg; - char* filter; + char *filter; /* times */ double start; @@ -91,25 +91,25 @@ struct _stats_tree { * key: parent node name * value: parent node */ - GHashTable* names; + GHashTable *names; /* used for quicker lookups of parent nodes */ - GPtrArray* parents; + GPtrArray *parents; /* * tree representation * to be defined (if needed) by the implementations */ - tree_pres* pr; + tree_pres *pr; /* every tree in nature has one */ - stat_node root; + stat_node root; }; struct _stats_tree_cfg { - guint8* abbr; - guint8* name; - guint8* tapname; + gchar* abbr; + gchar* name; + gchar* tapname; gboolean in_use; @@ -135,10 +135,10 @@ struct _stats_tree_cfg { /* * tree presentation callbacks */ - tree_cfg_pres* pr; + tree_cfg_pres *pr; - tree_pres* (*new_tree_pr)(stats_tree*); + tree_pres *(*new_tree_pr)(stats_tree*); void (*free_tree_pr)(stats_tree*); void (*draw_tree)(stats_tree*); void (*reset_tree)(stats_tree*); @@ -146,57 +146,57 @@ struct _stats_tree_cfg { /* guess what, this is it! */ extern void stats_tree_presentation(void (*registry_iterator)(gpointer,gpointer,gpointer), - void (*setup_node_pr)(stat_node*), - void (*free_node_pr)(stat_node*), - void (*draw_node)(stat_node*), - void (*reset_node)(stat_node*), - tree_pres* (*new_tree_pr)(stats_tree*), - void (*free_tree_pr)(stats_tree*), - void (*draw_tree)(stats_tree*), - void (*reset_tree)(stats_tree*), - void* data); - -extern stats_tree* stats_tree_new(stats_tree_cfg* cfg, tree_pres* pr, char* filter); + void (*setup_node_pr)(stat_node*), + void (*free_node_pr)(stat_node*), + void (*draw_node)(stat_node*), + void (*reset_node)(stat_node*), + tree_pres *(*new_tree_pr)(stats_tree*), + void (*free_tree_pr)(stats_tree*), + void (*draw_tree)(stats_tree*), + void (*reset_tree)(stats_tree*), + void *data); + +extern stats_tree *stats_tree_new(stats_tree_cfg *cfg, tree_pres *pr, char *filter); /* callback for taps */ extern int stats_tree_packet(void*, packet_info*, epan_dissect_t*, const void *); /* callback for reset */ -extern void stats_tree_reset(void* p_st); +extern void stats_tree_reset(void *p_st); /* callback for clear */ -extern void stats_tree_reinit(void* p_st); +extern void stats_tree_reinit(void *p_st); /* callback for destoy */ -extern void stats_tree_free(stats_tree* st); +extern void stats_tree_free(stats_tree *st); /* given an optarg splits the abbr part and returns a newly allocated buffer containing it */ -extern guint8* stats_tree_get_abbr(const guint8* optarg); +extern gchar *stats_tree_get_abbr(const gchar *optarg); /* obtains a stats tree from the registry given its abbr */ -extern stats_tree_cfg* stats_tree_get_cfg_by_abbr(guint8* abbr); +extern stats_tree_cfg *stats_tree_get_cfg_by_abbr(gchar *abbr); /* extracts node data as strings from a stat_node into the buffers given by value, rate and precent if NULL they are ignored */ -extern void stats_tree_get_strs_from_node(const stat_node* node, - guint8* value, - guint8* rate, - guint8* percent); +extern void stats_tree_get_strs_from_node(const stat_node *node, + guint8 *value, + guint8 *rate, + guint8 *percent); /* populates the given GString with a tree representation of a branch given by node, using indent spaces as indentation */ -extern void stats_tree_branch_to_str(const stat_node* node, - GString* s, - guint indent); +extern void stats_tree_branch_to_str(const stat_node *node, + GString *s, + guint indent); /* used to calcuate the size of the indentation and the longest string */ -extern guint stats_tree_branch_max_namelen(const stat_node* node, guint indent); +extern guint stats_tree_branch_max_namelen(const stat_node *node, guint indent); /* a text representation of a node, if buffer is NULL returns a newly allocated string */ -extern guint8* stats_tree_node_to_str(const stat_node* node, - guint8* buffer, guint len); +extern gchar *stats_tree_node_to_str(const stat_node *node, + gchar *buffer, guint len); #endif /* __STATS_TREE_PRIV_H */ -- cgit v1.2.1