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

Re: [libvirt] [PATCH] sexpr: Improve serialization error reporting



On Fri, May 27, 2011 at 03:09:36PM +0200, Matthias Bolte wrote:
> ---
>  src/util/sexpr.c |   12 +++++-------
>  1 files changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/src/util/sexpr.c b/src/util/sexpr.c
> index d8d4c2d..0e30087 100644
> --- a/src/util/sexpr.c
> +++ b/src/util/sexpr.c
> @@ -215,7 +215,7 @@ sexpr2string(const struct sexpr *sexpr, virBufferPtr buffer)
>          virBufferAddChar(buffer, '(');
>  
>          if (sexpr2string(sexpr->u.s.car, buffer) < 0)
> -            goto error;
> +            return -1;
>  
>          while (sexpr->u.s.cdr->kind != SEXPR_NIL) {
>              sexpr = sexpr->u.s.cdr;
> @@ -223,7 +223,7 @@ sexpr2string(const struct sexpr *sexpr, virBufferPtr buffer)
>              virBufferAddChar(buffer, ' ');
>  
>              if (sexpr2string(sexpr->u.s.car, buffer) < 0)
> -                goto error;
> +                return -1;
>          }
>  
>          virBufferAddChar(buffer, ')');
> @@ -241,14 +241,12 @@ sexpr2string(const struct sexpr *sexpr, virBufferPtr buffer)
>          virBufferAddLit(buffer, "()");
>          break;
>      default:
> -        goto error;
> +        virSexprError(VIR_ERR_SEXPR_SERIAL,
> +                      _("unknown s-expression kind %d"), sexpr->kind);
> +        return -1;
>      }
>  
>      return 0;
> -
> -  error:
> -    virSexprError(VIR_ERR_SEXPR_SERIAL, NULL);
> -    return -1;
>  }
>  
>  #define IS_SPACE(c) ((c == 0x20) || (c == 0x9) || (c == 0xD) || (c == 0xA))


ACK


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


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