diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-04-12 17:44:47 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-04-12 17:44:47 +0100 |
commit | e5f63f2ca9c3d437cfc717f6ccbdecf7804e6b3e (patch) | |
tree | 44bdda2fcbc680760145b6fb82f00b2fad6dec35 /tools/libxl/libxl_utils.c | |
parent | 0ac8d8f1693527efd5f3a20ba8662f80434a1597 (diff) | |
download | xen-e5f63f2ca9c3d437cfc717f6ccbdecf7804e6b3e.tar.gz xen-e5f63f2ca9c3d437cfc717f6ccbdecf7804e6b3e.tar.bz2 xen-e5f63f2ca9c3d437cfc717f6ccbdecf7804e6b3e.zip |
xl: Remove some duplicated boilerplate. (Improves logging slightly.)
We remove six lines of boilerplate from the top of each function, and
instead have a single struct libxl_ctx which is initialised once at
the top of main.
Likewise we wrap domain_qualifier_to_domid in a new function
find_domain, which does the error handling, and stores the domid and
the specified name (if applicable).
This reduces the size of xl.c by 7% (!)
As a beneficial side effect, the earlier call to libxl_ctx_set_log in
main makes some lost messages appear.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/libxl_utils.c')
-rw-r--r-- | tools/libxl/libxl_utils.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c index c4dc74c603..8fc7d0d89c 100644 --- a/tools/libxl/libxl_utils.c +++ b/tools/libxl/libxl_utils.c @@ -55,7 +55,8 @@ char *libxl_domid_to_name(struct libxl_ctx *ctx, uint32_t domid) return s; } -int libxl_name_to_domid(struct libxl_ctx *ctx, char *name, uint32_t *domid) +int libxl_name_to_domid(struct libxl_ctx *ctx, const char *name, + uint32_t *domid) { int i, nb_domains; char *domname; |