[Bro-Dev] Question about a BroString Constructor

Robin Sommer robin at icir.org
Mon Nov 5 13:52:30 PST 2012


On Mon, Nov 05, 2012 at 15:46 +0000, you wrote:

> Any thoughts on this? Is this intended behavior? I suspect that any
> changes to BroString would require a lot of changes downstream.

Agreed, it's inconsistent and error-prone. Worse, we have more such
cases in other classes as well; sometimes methods take ownership and
sometimes they don't. Unfortunately, as you say, changing these things
is hard because of the ripple effect it can have downstream, including
the potential to introduce very subtle bugs.

What we can do easily though is document these cases: just comments 
about ownership would already help a lot. I'm going ahead and will add
these for the BroString ctors. Feel free to submit patches for other
cases you run across.

(Longer-term, perhaps there's somethign to do with automatic code
analysis/refactoring tools; here, for example, a tool could at least
identify all uses of that particular method, and maybe even report
what an ownership change might break down the road).

Robin

-- 
Robin Sommer * Phone +1 (510) 722-6541 * robin at icir.org
ICSI/LBNL    * Fax   +1 (510) 666-2956 *   www.icir.org


More information about the bro-dev mailing list