WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

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

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] initialize few structure fully to zero with talloc_zero
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 23 Feb 2006 19:42:07 +0000
Delivery-date: Thu, 23 Feb 2006 19:42:22 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] initialize few structure fully to zero with talloc_zero, Xen patchbot -unstable <=