[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] initialize few structure fully to zero with talloc_zero



# HG changeset patch
# User vhanquez@xxxxxxxxxxxxxxxxxxxxxxx
# Node ID 643940bb3e50ebeac243f422f5af780fea1442da
# Parent  b40aefd658c0eecfea9aaa3e85e9b2b4727154bd
initialize few structure fully to zero with talloc_zero
instead of explicitely initializing some fields to NULL.

Signed-off-by: Vincent Hanquez <vincent@xxxxxxxxxxxxx>

diff -r b40aefd658c0 -r 643940bb3e50 tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c   Thu Feb 23 16:29:06 2006
+++ b/tools/xenstore/xenstored_core.c   Thu Feb 23 17:14:55 2006
@@ -573,14 +573,11 @@
 {
        struct buffered_data *data;
 
-       data = talloc(ctx, struct buffered_data);
+       data = talloc_zero(ctx, struct buffered_data);
        if (data == NULL)
                return NULL;
        
        data->inhdr = true;
-       data->used = 0;
-       data->buffer = NULL;
-
        return data;
 }
 
@@ -1394,17 +1391,13 @@
        struct node *node;
        struct xs_permissions perms = { .id = 0, .perms = XS_PERM_NONE };
 
-       node = talloc(NULL, struct node);
+       node = talloc_zero(NULL, struct node);
        node->name = name;
        node->perms = &perms;
        node->num_perms = 1;
-       node->data = NULL;
-       node->datalen = 0;
        node->children = (char *)child;
        if (child)
                node->childlen = strlen(child) + 1;
-       else
-               node->childlen = 0;
 
        if (!write_node(NULL, node))
                barf_perror("Could not create initial node %s", name);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.