This is the mail archive of the
mailing list for the elfutils project.
Re: [PATCH] libdwfl: Correct nested asprintf result check in report_kernel_archive.
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Sat, 21 Dec 2013 17:10:37 +0100
- Subject: Re: [PATCH] libdwfl: Correct nested asprintf result check in report_kernel_archive.
On Fri, Dec 20, 2013 at 03:09:28PM -0800, Roland McGrath wrote:
> Personally I'd like it better as a ?: in the initializer rather than an if
> (no repetition of "res ="). But I agree that putting the unlikely (... < 0)
> separate from the ... makes it easier to follow.
Yeah, I think you are right, I overdid it because I was a little embarrassed
I had to count the brackets 6 times before seeing the bug even after it was
pointed out to me. Pushed the simplified version:
int res = (((*release) == '/')
? asprintf (&archive, "%s/debug.a", *release)
: asprintf (&archive, MODULEDIRFMT "/debug.a", *release));
if (unlikely (res < 0))