diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2003-12-02 10:23:18 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2003-12-02 10:23:18 +0000 |
commit | bfaca0cab6888f39623afd5d8f75a8fb39f24ec0 (patch) | |
tree | e97c89575023b23bbe32c74bd70d98f8908f6cc0 /epan/tvbuff.c | |
parent | 266b5a4b2e6ad843a05d4f4c6a1f6ebf19949a06 (diff) |
Move the definition of the tvbuff_t structure and friends to tvbuff.h
so that we can change tvb_get_ds_tvb() into a macro.
This function was a single line assignment and was called a lot.
This made tethereal ~2.5% faster in one testcase I use.
svn path=/trunk/; revision=9141
Diffstat (limited to 'epan/tvbuff.c')
-rw-r--r-- | epan/tvbuff.c | 69 |
1 files changed, 1 insertions, 68 deletions
diff --git a/epan/tvbuff.c b/epan/tvbuff.c index 19df4d86bf..c3b8a69a2d 100644 --- a/epan/tvbuff.c +++ b/epan/tvbuff.c @@ -9,7 +9,7 @@ * the data of a backing tvbuff, or can be a composite of * other tvbuffs. * - * $Id: tvbuff.c,v 1.51 2003/09/28 21:39:53 guy Exp $ + * $Id: tvbuff.c,v 1.52 2003/12/02 10:23:18 sahlberg Exp $ * * Copyright (c) 2000 by Gilbert Ramirez <gram@alumni.rice.edu> * @@ -45,67 +45,6 @@ #include "tvbuff.h" #include "strutil.h" -typedef struct { - /* The backing tvbuff_t */ - tvbuff_t *tvb; - - /* The offset/length of 'tvb' to which I'm privy */ - guint offset; - guint length; - -} tvb_backing_t; - -typedef struct { - GSList *tvbs; - - /* Used for quick testing to see if this - * is the tvbuff that a COMPOSITE is - * interested in. */ - guint *start_offsets; - guint *end_offsets; - -} tvb_comp_t; - -struct tvbuff { - /* Record-keeping */ - tvbuff_type type; - gboolean initialized; - guint usage_count; - tvbuff_t* ds_tvb; /* data source top-level tvbuff */ - - /* The tvbuffs in which this tvbuff is a member - * (that is, a backing tvbuff for a TVBUFF_SUBSET - * or a member for a TVB_COMPOSITE) */ - GSList *used_in; - - /* TVBUFF_SUBSET and TVBUFF_COMPOSITE keep track - * of the other tvbuff's they use */ - union { - tvb_backing_t subset; - tvb_comp_t composite; - } tvbuffs; - - /* We're either a TVBUFF_REAL_DATA or a - * TVBUFF_SUBSET that has a backing buffer that - * has real_data != NULL, or a TVBUFF_COMPOSITE - * which has flattened its data due to a call - * to tvb_get_ptr(). - */ - guint8 *real_data; - - /* Length of virtual buffer (and/or real_data). */ - guint length; - - /* Reported length. */ - guint reported_length; - - /* Offset from beginning of first TVBUFF_REAL. */ - gint raw_offset; - - /* Func to call when actually freed */ - tvbuff_free_cb_t free_cb; -}; - static guint8* ensure_contiguous_no_exception(tvbuff_t *tvb, gint offset, gint length, int *exception); @@ -2136,12 +2075,6 @@ tvb_bytes_to_str(tvbuff_t *tvb, gint offset, gint len) return bytes_to_str(tvb_get_ptr(tvb, offset, len), len); } -tvbuff_t * -tvb_get_ds_tvb(tvbuff_t *tvb) -{ - return tvb->ds_tvb; -} - /* Find a needle tvbuff within a haystack tvbuff. */ gint tvb_find_tvb(tvbuff_t *haystack_tvb, tvbuff_t *needle_tvb, gint haystack_offset) |