Extending torture_assert_* macros
abartlet at samba.org
Mon Jul 5 16:09:07 MDT 2010
On Mon, 2010-07-05 at 16:34 +0300, Kamen Mazdrashki wrote:
> Hi list,
> I want to introduce a torture_assert_*_fmt family of macros in
> which are to work much in the same way as DEBUG macro does.
> I pushed first few commits in this direction here:
> In order to achieve this I had to introduce new public function
> - torture_format_msg_helper()
> to be used to format messages just by passing (format_string, ....
> params) tuple
> (neither talloc_asprintf() nor asprintf() has such simplified
> The thing is that I don't quite like to introduce a whole new public
> just to be able to format messages in torture_assert_* macros.
Why not? What is the cost here?
> Does anyone has an idea how to achieve same effect without
> implementing new function?
This approach, and the patches you propose, look reasonable to me. The
only thing I would say is to convert all the existing tortore_assert
callers, so we don't have a special _fmt variant.
The only comment I would make is: Don't declare:
const char *cmt = torture_format_msg_helper cmt_args; \
as 'const char *', as you need to talloc_free it shortly. Also, choose
a more unusual name, as you don't want to get warnings from shadowing a
local variable in the caller.
Andrew Bartlett http://samba.org/~abartlet/
Authentication Developer, Samba Team http://samba.org
Samba Developer, Cisco Inc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 190 bytes
Desc: This is a digitally signed message part
More information about the samba-technical