From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Jackson Subject: Re: [PATCH v5 22/24] libxlu: introduce new APIs Date: Fri, 13 Feb 2015 14:12:29 +0000 Message-ID: <21726.1613.938775.555517@mariner.uk.xensource.com> References: <1423770294-9779-1-git-send-email-wei.liu2@citrix.com> <1423770294-9779-23-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1423770294-9779-23-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu Cc: ian.campbell@citrix.com, andrew.cooper3@citrix.com, dario.faggioli@citrix.com, ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, JBeulich@suse.com, ufimtseva@gmail.com List-Id: xen-devel@lists.xenproject.org Wei Liu writes ("[PATCH v5 22/24] libxlu: introduce new APIs"): > These APIs can be used to manipulate XLU_ConfigValue and XLU_ConfigList. > > + if (value->type != XLU_STRING) { > + if (!dont_warn) > + fprintf(cfg->report, "warning: value is not a string\n"); > + *value_r = NULL; > + return EINVAL; This message needs to include the file and line number, or it is very hard for the user to use. The other call sites (which are based on `find') require the caller to provide a name, which means that the setting name can be printed too. Maybe you could do something similar. If you were feeling keen you could replace these formulaic things with something like: return report_bad_cfg(dont_warn, cfg, set, n, "value is not a string"); or return REPORT_BAD_CFG("value is not a string"); (being a function or macro which always returns EINVAL), or some such. Thanks, Ian.