
On Fri, Jun 29, 2007 at 10:21:42AM -0400, Daniel Veillard wrote:
On Fri, Jun 29, 2007 at 03:08:47PM +0100, Daniel P. Berrange wrote:
On Wed, Jun 27, 2007 at 07:04:00PM +0100, Daniel P. Berrange wrote:
+#define GET_NETWORK_PRIVATE(conn,retcode) \ + struct private_data *priv = (struct private_data *) (conn)->networkPrivateData; \ + assert (priv); \ + if (priv->magic == DEAD) { \ + error (conn, VIR_ERR_INVALID_ARG, \ + "tried to use a closed or uninitialised handle"); \ + return (retcode); \ + } \ + assert (priv->magic == MAGIC) + static int call (virConnectPtr conn, struct private_data *priv, int in_open, int proc_nr, xdrproc_t args_filter, char *args, xdrproc_t ret_filter, char *ret);
Hum .... asserts .... Can't we make a normal test/error/exit handling so that errors there can be chanelled the same way as any other ?
I removed the assert & made the test be if (!priv || priv->magic != MAGIC)
[...]
+ +/* Must not overlap with virDrvOpenFlags */ +enum { + VIR_DRV_OPEN_REMOTE_UNIX = (1 << 8), + VIR_DRV_OPEN_REMOTE_USER = (1 << 9), + VIR_DRV_OPEN_AUTOSTART = (1 << 10), +} virDrvOpenRemoteFlags;
then maybe both enums definitions should be defined next to each other finding the requirement when editing somewhere else relies on luck, let's move the definition closer.
I changed the way the enum is used so you don't need to worry about clash with virDrvOpenFlags. Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|