[asterisk-dev] backport RAII_VAR to 1.8?

Matthew Jordan mjordan at digium.com
Fri May 17 12:54:42 CDT 2013


On 05/17/2013 12:35 PM, Paul Belanger wrote:
> On 13-05-17 01:22 PM, Matthew Jordan wrote:
>> On 05/17/2013 10:46 AM, Richard Mudgett wrote:

<snip>

> A better question would be, would you backport it into certified
> asterisk too?

We don't remove things for Certified Asterisk. Things sometimes get
added (albeit rarely), but at the end of the day, Certified Asterisk
1.8.15 has the same things as Asterisk 1.8.15.0. Certified Asterisk 11.2
has the same things as Asterisk 11.2.0. That isn't going to change.

Hypothetically speaking, if Russell backported RAII_VAR into 1.8 and it
was released in 1.8.24.0, and we made a Certified Asterisk release from
1.8.24.0, then yes, it would be in Certified Asterisk 1.8.24.

> I'm always against backporting to a release branch, simply because we
> never can fully predict the results. That said, I'm still at 1.8.7.1, so
> as long as we expect bug reports to happen and we address any
> regressions with higher priority, but that is just my opinion.
> 

What bug reports would occur from inclusion of a macro that - if the
code is written correctly - results in the same semantics without its
inclusion?

That is - how do you get a bug from:

struct foo *f = ast_create_foo();

if (off_nominal) {
  ao2_cleanup(f);
  return;
}

To:

RAII_VAR(struct foo *, f, ast_create_foo(), ao2_cleanup);

if (off_nominal) {
  return;
}

FYI: the awesomeness of RAII_VAR is that it reduces bugs. Heck, we just
fixed two ref count leaks in res_fax by switching to RAII_VAR. Granted,
they were ridiculously off nominal paths, but that's one of many reasons
why RAII_VAR is so handy - it cleans up ref counted objects in off
nominal paths for you, reducing the likelihood of coding errors.

-- 
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org





More information about the asterisk-dev mailing list