|
From: | Gerd Hoffmann |
Subject: | Re: [Qemu-devel] [PATCH] qdev: add return value to init() callbacks. |
Date: | Thu, 13 Aug 2009 13:05:45 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Lightning/1.0pre Thunderbird/3.0b2 |
Hi,
I find stashing error messages for later printing rather awkward. Do you provide space for one fixed-sized message? Or arbitrary length? Arbitrary number of messages? Once you start to malloc(), you get to worry about free()... Meh.
Arbitrary length. See attached patch.
I'd rather use the global or thread-local state to hold the sink for the messages, then send the messages there as we make them. No memory management worries.
i.e. like config_error() in net.c? What I don't like there is that the error handling policy (monitor -> continue, otherwise exit) is in the error printing function. IMHO it is the job of the caller to decide how to handle an error (exit, ignore, pass up, whatever).
cheers, Gerd
fix
Description: Text document
[Prev in Thread] | Current Thread | [Next in Thread] |