change multiple if statements by isspace() + uneeded memset

Andreas Ericsson ae at op5.se
Tue Nov 27 17:00:32 CET 2012


On 11/27/2012 02:51 PM, Ricardo Jose Maraschini wrote:
> Hya,
> 
> calloc already sets memory to 0 and i think that if we already have
> a function to verify if a given char is an space, we should use it.
> 
> ok? comments?
> 

"isspace()" takes locale into account, but nagiostats will only ever
read 7-bit ascii as syntactically important, so that part of the patch
is wrong. "isspace()" also takes form feeds and vertical tabs, which
the current code doesn't.

The memset() part of the patch is technically correct. The gains of
removing it is about one nanosecond per program start, but since
it's an easy fix I'll apply it anyway.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov




More information about the Developers mailing list