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

Re: [Libguestfs] [PATCH libguestfs 17/23] generator.ml: move String/Device decls "down" to definition



On Wed, Aug 12, 2009 at 06:52:53PM +0200, Jim Meyering wrote:
> From: Jim Meyering <meyering redhat com>
> 
> ---
>  src/generator.ml |   10 +++++-----
>  1 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/generator.ml b/src/generator.ml
> index f9032fb..8aa36bd 100755
> --- a/src/generator.ml
> +++ b/src/generator.ml
> @@ -4691,9 +4691,9 @@ and generate_daemon_actions () =
>             pr "  struct guestfs_%s_args args;\n" name;
>             List.iter (
>               function
> -             | Device n -> pr "  const char *%s;\n" n
> +             | Device n
>               | Pathname n
> -             | String n
> +             | String n -> ()
>               | OptString n -> pr "  char *%s;\n" n
>               | StringList n -> pr "  char **%s;\n" n
>               | Bool n -> pr "  int %s;\n" n
> @@ -4715,12 +4715,12 @@ and generate_daemon_actions () =
>             List.iter (
>               function
>               | Pathname n ->
> -                 pr "  %s = args.%s;\n" n n;
> +                 pr "  char *%s = args.%s;\n" n n;
>                   pr "  ABS_PATH (%s, goto done);\n" n;
>  	     | Device n ->
> -                 pr "  %s = args.%s;\n" n n;
> +                 pr "  char *%s = args.%s;\n" n n;
>                   pr "  RESOLVE_DEVICE (%s, goto done);" n;
> -             | String n -> pr "  %s = args.%s;\n" n n
> +             | String n -> pr "  char *%s = args.%s;\n" n 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

This patch is a bit unusual (although not wrong).

It sort of redistributes the C variable declarations between two
sections of code.  Device|Pathname|String use an inline declaration:

  char *foo = args.foo;

whereas OptString|StringList|Bool use:

  type foo;
  ...
  foo = args.foo;

ACK-ish.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top


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