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

Re: [Libguestfs] [PATCH libguestfs 22/23] generator.ml: factor out "pr_args n" function



On Wed, Aug 12, 2009 at 06:52:58PM +0200, Jim Meyering wrote:
> From: Jim Meyering <meyering redhat com>
> 
> ---
>  src/generator.ml |   11 +++++++----
>  1 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/src/generator.ml b/src/generator.ml
> index 70ccbef..256283f 100755
> --- a/src/generator.ml
> +++ b/src/generator.ml
> @@ -4712,18 +4712,21 @@ and generate_daemon_actions () =
>             pr "    reply_with_error (\"%%s: daemon failed to decode procedure arguments\", \"%s\");\n" name;
>             pr "    return;\n";
>             pr "  }\n";
> +	   let pr_args n =
> +	     pr "  char *%s = args.%s;\n" n n
> +	   in
>             List.iter (
>               function
>               | Pathname n ->
> -                 pr "  char *%s = args.%s;\n" n n;
> +                 pr_args n;
>                   pr "  ABS_PATH (%s, goto done);\n" n;
>               | Device n ->
> -                 pr "  char *%s = args.%s;\n" n n;
> +                 pr_args n;
>                   pr "  RESOLVE_DEVICE (%s, goto done);" n;
>  	     | Dev_or_Path n ->
> -                 pr "  char *%s = args.%s;\n" n n;
> +                 pr_args n;
>                   pr "  REQUIRE_ROOT_OR_RESOLVE_DEVICE (%s, goto done);" n;
> -             | String n -> pr "  char *%s = args.%s;\n" n n
> +             | String n -> pr_args n
>               | OptString n -> pr "  %s = args.%s ? *args.%s : NULL;\n" n n n
>               | StringList n ->
>                   pr "  %s = realloc (args.%s.%s_val,\n" n n n;
> -- 
> 1.6.4.337.g5420e

As discussed before, ACK.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/


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