On 06/27/2011 04:13 AM, Daniel P. Berrange wrote:
On Mon, Jun 27, 2011 at 05:25:17PM +0900, Minoru Usui wrote:
> sysinfo: delete unnecessary white space of sysinfo.
>
> * Add virSkipSpacesBackwards() to src/util/util.[ch]
> * Trim each element and delete null entry of sysinfo by virSkipSpacesBackwards().
>
> Signed-off-by: Minoru Usui <usui(a)mxm.nes.nec.co.jp>
> ---
> src/util/sysinfo.c | 34 +++++++++++++++++++++++++---------
> src/util/util.c | 27 +++++++++++++++++++++++++++
> src/util/util.h | 1 +
> 3 files changed, 53 insertions(+), 9 deletions(-)
> +void
> +virSkipSpacesBackwards(const char *str, char **endp)
> +{
> + char *cur;
> +
> + if (!endp || !*endp)
> + return;
> +
> + cur = *endp - 1;
> + while (cur >= str) {
> + if ((*cur == ' ') || (*cur == '\t') || (*cur ==
'\n') ||
> + (*cur == '\r') || (*cur == '\\'))
Maybe we should use c_isspace() instead of open-coding this. And how is
backslash a space?
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org