]> git.proxmox.com Git - mirror_lxc.git/commitdiff
cleanup: remove unnecessary zeroing
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 6 Sep 2017 09:45:03 +0000 (11:45 +0200)
committerStéphane Graber <stgraber@ubuntu.com>
Sun, 10 Sep 2017 18:00:36 +0000 (14:00 -0400)
The entire netdev is zeroed via memset() already. Unions and
all.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/lxc/confile_legacy.c
src/lxc/confile_utils.c

index 80dd3851e728b8efc77be01e8b4d76eef77debf5..93df473764b38503b3a298901fa3837541a1b168 100644 (file)
@@ -170,16 +170,6 @@ int set_config_network_legacy_type(const char *key, const char *value,
        lxc_list_init(&netdev->ipv4);
        lxc_list_init(&netdev->ipv6);
 
-       netdev->name[0] = '\0';
-       netdev->link[0] = '\0';
-       memset(&netdev->priv, 0, sizeof(netdev->priv));
-       /* I'm not completely sure if the memset takes care to zero the arrays
-        * in the union as well. So let's make extra sure and set the first byte
-        * to zero so that we don't have any surprises.
-        */
-       netdev->priv.veth_attr.pair[0] = '\0';
-       netdev->priv.veth_attr.veth1[0] = '\0';
-
        list = malloc(sizeof(*list));
        if (!list) {
                SYSERROR("failed to allocate memory");
index 02924fa93870801ae889489443ac148918398c11..d43d516db5973538f5c5761822f44c5c4433267b 100644 (file)
@@ -183,15 +183,6 @@ struct lxc_netdev *lxc_network_add(struct lxc_list *networks, int idx, bool tail
        memset(netdev, 0, sizeof(*netdev));
        lxc_list_init(&netdev->ipv4);
        lxc_list_init(&netdev->ipv6);
-       netdev->name[0] = '\0';
-       netdev->link[0] = '\0';
-       memset(&netdev->priv, 0, sizeof(netdev->priv));
-       /* I'm not completely sure if the memset takes care to zero the arrays
-        * in the union as well. So let's make extra sure and set the first byte
-        * to zero so that we don't have any surprises.
-        */
-       netdev->priv.veth_attr.pair[0] = '\0';
-       netdev->priv.veth_attr.veth1[0] = '\0';
 
        /* give network a unique index */
        netdev->idx = idx;