On 04/ 5/10 03:49 PM, [email protected] wrote:
On Mon, Apr 05, 2010 at 03:38:56PM -0500, Shawn Walker wrote:
- _fromstr(): Would it make sense to create a macro for the following
bit of code:
Py_XDECREF(attr);
Py_XDECREF(attrs);
Py_XDECREF(hash);
Py_XDECREF(key);
Py_XDECREF(type);
And just call that instead of typing out the xdecrefs every single
time?
Except that would be decrementing more than I am now. A lot of the
error cases only decrement attrs, key, and attr. Are you saying the
other cases should be decrementing hash, key, and type anytime they
do a "return (NULL);" ?
I'm not sure my suggestion would work, but it did occur to me since all
of the references that are getting manipulated by _fromstr() are either
created by it or by add_to_attrs(). If the purpose of the [X]DECREF in
the error path is to zero the refcounts and release the resources, I
wondered if the error handling could be further commonized. If the
answer is no, that's fine, but I was curious.
updated webrev (diff against 2nd webrev):
http://cr.opensolaris.org/~swalker/pkg-slots-v2-v3/
Full test suite passed; memory usage remains as expected.
Cheers,
-Shawn
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss