[lxc-devel] [PATCH 3/3] Do not pass global variable as pointer
Serge Hallyn
serge.hallyn at ubuntu.com
Mon Nov 9 23:34:20 UTC 2015
Quoting Christian Brauner (christian.brauner at mailbox.org):
> Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>
> ---
> src/lxc/lxc_copy.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/src/lxc/lxc_copy.c b/src/lxc/lxc_copy.c
> index e5f52d2..791d7a2 100644
> --- a/src/lxc/lxc_copy.c
> +++ b/src/lxc/lxc_copy.c
> @@ -123,8 +123,7 @@ Options :\n\
> .daemonize = 1,
> };
>
> -static struct mnts *add_mnt(struct mnts **mnts, unsigned int *num,
> - enum mnttype type);
> +static struct mnts *add_mnt(struct mnts **mnts, enum mnttype type);
> static int mk_rand_ovl_dirs(struct mnts *mnts, struct lxc_arguments *my_args);
> static char *construct_path(char *path, bool as_prefix);
> static char *set_mnt_entry(struct mnts *m);
> @@ -211,17 +210,17 @@ int main(int argc, char *argv[])
> exit(EXIT_FAILURE);
> }
>
> -static struct mnts *add_mnt(struct mnts **mnts, unsigned int *num, enum mnttype type)
> +static struct mnts *add_mnt(struct mnts **mnts, enum mnttype type)
> {
> struct mnts *m, *n;
>
> - n = realloc(*mnts, (*num + 1) * sizeof(struct mnts));
> + n = realloc(*mnts, (num + 1) * sizeof(struct mnts));
> if (!n)
> return NULL;
>
> *mnts = n;
> - m = *mnts + *num;
> - (*num)++;
> + m = *mnts + num;
> + num++;
>
> *m = (struct mnts) {.type = type};
>
> @@ -401,6 +400,7 @@ static int do_clone_ephemeral(struct lxc_container *c,
> goto err;
>
> /* allocate and set mount entries */
> + printf("%u\n", num);
left-over debugging?
More information about the lxc-devel
mailing list