performance update
replace tvb_raw_offset() which is essentially a simple assignment and which is called a lot with a macro. this makes my tethereal testcase 2-3% faster. svn path=/trunk/; revision=9152
This commit is contained in:
parent
dcd98ae8d3
commit
5ff0237060
|
@ -1,7 +1,7 @@
|
|||
/* proto.c
|
||||
* Routines for protocol tree
|
||||
*
|
||||
* $Id: proto.c,v 1.122 2003/12/03 09:28:22 guy Exp $
|
||||
* $Id: proto.c,v 1.123 2003/12/03 09:50:40 sahlberg Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -1884,9 +1884,7 @@ alloc_field_info(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
|
|||
|
||||
fi->hfinfo = hfinfo;
|
||||
fi->start = start;
|
||||
if (tvb) {
|
||||
fi->start += tvb_raw_offset(tvb);
|
||||
}
|
||||
fi->start+=(tvb)?TVB_RAW_OFFSET(tvb):0;
|
||||
fi->length = *length;
|
||||
fi->tree_type = -1;
|
||||
fi->visible = PTREE_DATA(tree)->visible;
|
||||
|
@ -2001,7 +1999,7 @@ proto_item_set_end(proto_item *pi, tvbuff_t *tvb, gint end)
|
|||
if (pi == NULL)
|
||||
return;
|
||||
fi = PITEM_FINFO(pi);
|
||||
end += tvb_raw_offset(tvb);
|
||||
end += TVB_RAW_OFFSET(tvb);
|
||||
fi->length = end - fi->start;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* the data of a backing tvbuff, or can be a composite of
|
||||
* other tvbuffs.
|
||||
*
|
||||
* $Id: tvbuff.c,v 1.52 2003/12/02 10:23:18 sahlberg Exp $
|
||||
* $Id: tvbuff.c,v 1.53 2003/12/03 09:50:40 sahlberg Exp $
|
||||
*
|
||||
* Copyright (c) 2000 by Gilbert Ramirez <gram@alumni.rice.edu>
|
||||
*
|
||||
|
@ -717,7 +717,7 @@ first_real_data_ptr(tvbuff_t *tvb)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
int
|
||||
offset_from_real_beginning(tvbuff_t *tvb, int counter)
|
||||
{
|
||||
tvbuff_t *member;
|
||||
|
@ -737,15 +737,6 @@ offset_from_real_beginning(tvbuff_t *tvb, int counter)
|
|||
return 0;
|
||||
}
|
||||
|
||||
gint
|
||||
tvb_raw_offset(tvbuff_t *tvb)
|
||||
{
|
||||
if (tvb->raw_offset == -1) {
|
||||
tvb->raw_offset = offset_from_real_beginning(tvb, 0);
|
||||
}
|
||||
return tvb->raw_offset;
|
||||
}
|
||||
|
||||
static guint8*
|
||||
composite_ensure_contiguous_no_exception(tvbuff_t *tvb, guint abs_offset,
|
||||
guint abs_length)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* the data of a backing tvbuff, or can be a composite of
|
||||
* other tvbuffs.
|
||||
*
|
||||
* $Id: tvbuff.h,v 1.35 2003/12/02 10:23:18 sahlberg Exp $
|
||||
* $Id: tvbuff.h,v 1.36 2003/12/03 09:50:40 sahlberg Exp $
|
||||
*
|
||||
* Copyright (c) 2000 by Gilbert Ramirez <gram@alumni.rice.edu>
|
||||
*
|
||||
|
@ -284,8 +284,11 @@ extern gint tvb_reported_length_remaining(tvbuff_t *tvb, gint offset);
|
|||
Also adjusts the data length. */
|
||||
extern void tvb_set_reported_length(tvbuff_t*, guint);
|
||||
|
||||
extern int offset_from_real_beginning(tvbuff_t *tvb, int counter);
|
||||
|
||||
/* Returns the offset from the first byte of real data. */
|
||||
extern gint tvb_raw_offset(tvbuff_t*);
|
||||
#define TVB_RAW_OFFSET(tvb) \
|
||||
((tvb->raw_offset==-1)?(tvb->raw_offset = offset_from_real_beginning(tvb, 0)):tvb->raw_offset)
|
||||
|
||||
/************** START OF ACCESSORS ****************/
|
||||
/* All accessors will throw an exception if appropriate */
|
||||
|
|
Loading…
Reference in New Issue