From e5f63f2ca9c3d437cfc717f6ccbdecf7804e6b3e Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Mon, 12 Apr 2010 17:44:47 +0100 Subject: 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 --- tools/libxl/libxl_utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tools/libxl/libxl_utils.c') 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; -- cgit v1.2.3