[libvirt] sysinfo: delete unnecessary white space of sysinfo.

Eric Blake eblake at redhat.com
Mon Jun 27 15:03:57 UTC 2011


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 at 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 at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110627/58adae96/attachment-0001.sig>


More information about the libvir-list mailing list