[Libguestfs] [PATCH] generator: Introduce error code (errcode) concept.

Matthew Booth mbooth at redhat.com
Tue Mar 8 10:45:49 UTC 2011


On 07/03/11 19:34, Richard W.M. Jones wrote:
>> From 8037da06feea097716ce700f38c0eac0d5411a7c Mon Sep 17 00:00:00 2001
> From: Richard W.M. Jones<rjones at redhat.com>
> Date: Mon, 7 Mar 2011 19:28:30 +0000
> Subject: [PATCH] generator: Introduce error code (errcode) concept.
>
> There was a lot of repeated code to map return types (eg. RErr)
> to error cases (eg. -1 or NULL).
>
> This commit introduces an error code type and two functions to
> map return types to error codes and error codes to strings.
> ---
>   generator/generator_c.ml         |  122 ++++++++++++++++++++++----------------
>   generator/generator_capitests.ml |   56 ++++++++++--------
>   generator/generator_daemon.ml    |   40 +++++++------
>   generator/generator_java.ml      |   85 +++++++++++++++------------
>   generator/generator_ocaml.ml     |   58 ++++++++++--------
>   generator/generator_php.ml       |   57 ++++++++++--------
>   generator/generator_python.ml    |   46 ++++++++------
>   generator/generator_ruby.ml      |   40 +++++++-----
>   generator/generator_types.ml     |    4 +-
>   generator/generator_utils.ml     |   17 +++++-
>   generator/generator_utils.mli    |   13 ++++-
>   11 files changed, 315 insertions(+), 223 deletions(-)

Adds more than it removes: that's a little disappointing. Still, I think 
it is worth it to have a single 'repository' of error codes.

Incidentally, what's generator_utils.mli doing in there? Surely that's 
not under version control.

Matt
-- 
Matthew Booth, RHCA, RHCSS
Red Hat Engineering, Virtualisation Team

GPG ID:  D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490




More information about the Libguestfs mailing list