[Bro-Dev] #1013: redef'ing tables overwrites unrelated values
Bro Tracker
bro at tracker.bro.org
Wed Jun 5 08:19:27 PDT 2013
#1013: redef'ing tables overwrites unrelated values
-----------------------+------------------------
Reporter: dmandelb | Owner:
Type: Problem | Status: new
Priority: Medium | Milestone: Bro2.2
Component: Bro | Version: git/master
Resolution: | Keywords:
-----------------------+------------------------
Comment (by jsiwek):
This is typically how tables can be redef'd:
{{{
const foo: table[string] of double = {} &redef;
# full (re)initialization
redef foo = { ["nope"] = 37.0 };
# full (re)initialization, discards "nope" index
redef foo = { ["abc"] = 42.0 };
# add elements
redef foo += { ["def"] = -42.0, ["ghi"] = 7.0 };
# remove elements from LHS based on indices shared with RHS
redef foo -= { ["ghi"] = 0.0 };
# RHS is just a table value, the syntax of how it's represented shouldn't
matter
redef foo += table(["cool"] = 5.0);
print(foo);
}}}
Haven't yet looked in to whether what you tried (redef'ing an index
expression) can actually be used in a meaningful way or if it should
result in some error message.
--
Ticket URL: <http://tracker.bro.org/bro/ticket/1013#comment:1>
Bro Tracker <http://tracker.bro.org/bro>
Bro Issue Tracker
More information about the bro-dev
mailing list