On 04/04/14 16:08, Evan Huus wrote:
On Fri, Apr 4, 2014 at 4:04 PM, Guy Harris <guy@xxxxxxxxxxxx> wrote:
On Apr 4, 2014, at 7:30 AM, Hadriel Kaplan <hadriel.kaplan@xxxxxxxxxx> wrote:
And I'd like to see proto_tree_add_XXX_item() routines that add an item with a particular type *and* take a pointer argument and return the value for the item through that pointer; that could replace
xxx = tvb_get_XXX();
proto_tree_add_XXX(..., xxx);
combinations and
xxx = tvb_get_XXX();
proto_tree_add_item(...); /* re-fetches the item value */
with
proto_tree_add_XXX_item(..., &xxx);
That would be neat, though we would have to be careful with our
fast-path handling, since we should return the value regardless.
Yeah, Anders asked about doing that a while back [hmm, some years ago]
and I decided that it was going to be too much code (at least for my
patience level) to get around TRY_TO_FAKE_THIS_ITEM() and friends.