[Bro-Dev] "delete" of entire tables/sets
vern at corelight.com
Thu Dec 6 14:02:40 PST 2018
I'm working on some scripts where I want to remove every element from a
table in a single shot. In awk, "delete tbl" would do the trick, but Zeek
restricts delete operations to removing single elements. Worse, if I try
iterating over an aggregate to remove elements piece-wise, it doesn't
remove all of them, no doubt because the internal hash table is changing
mid-stream of the "for" loop and thus doesn't visit all of the members.
This means I have to first build up a *separate* vector of all the indexes,
then iterate over that to remove them.
Proposal: extend "delete" so that if applied to a table or a set, it clears
out all of its elements.
This seems straightforward to me, and something that I'll see if I can
find some cycles soon to hack out.
More information about the bro-dev