[asterisk-dev] [Code Review]: Add aggregate operations for stuctures with string fields
opticron
reviewboard at asterisk.org
Mon Feb 4 13:07:58 CST 2013
> On Feb. 4, 2013, 4:30 a.m., wdoekes wrote:
> > trunk/tests/test_stringfields.c, lines 328-330
> > <https://reviewboard.asterisk.org/r/2308/diff/1/?file=33260#file33260line328>
> >
> > ast_string_field_set(&inst2, string2, "bar");
> > ast_string_field_set(&inst2, string1, "foo");
> > inst2.foo = 2;
> >
> > --> fail
> >
> > Intentional?
>
> opticron wrote:
> If you're referring to the comparison macro evaluating inst1 as being equal to inst2 even though the foo member differs, this is intentional. The comparison macro only compares string field data and leaves the remainder to the person defining the whole-structure compare operation.
I see what you mean now, swapped settings of string fields causes the test to fail. This is an off-by-one error where the loop actually dips into the allocation pool. Fixed.
- opticron
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2308/#review7797
-----------------------------------------------------------
On Feb. 3, 2013, 3:12 p.m., opticron wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2308/
> -----------------------------------------------------------
>
> (Updated Feb. 3, 2013, 3:12 p.m.)
>
>
> Review request for Asterisk Developers.
>
>
> Summary
> -------
>
> This change adds aggregate operations on all string fields within a structure for copying and comparison to greatly simplify code which needs to do so. Traditionally, this is done by copying or comparing each field individually.
>
>
> Diffs
> -----
>
> trunk/include/asterisk/stringfields.h 380806
> trunk/tests/test_stringfields.c 380806
>
> Diff: https://reviewboard.asterisk.org/r/2308/diff
>
>
> Testing
> -------
>
> Passes the new unit tests that test these new aggregate operations (also in this review).
>
>
> Thanks,
>
> opticron
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130204/53c79991/attachment.htm>
More information about the asterisk-dev
mailing list