
On Wed, Jul 25, 2007 at 10:22:53AM +0100, Richard W.M. Jones wrote:
+ if (!strncmp(line, "processor", 9)) { //... + } else if (!strncmp(line, "cpu MHz", 7)) {
Gaah. I know we don't have macros for these, but "== 0".
We do now. STREQLEN(a,b,n) STRNEQLEN(a,b,n)
There might be a pathological cpuinfo file which has another entry beginning with ^processor. If only we were using a real language which allowed simple use of regexps.
It now checks that the data following is all whitespace upto the ':' character.
The error handling in this next section of the patch is wrong. It should call __virRaiseError when the files cannot be opened or if the functions fail for some reason. In the Solaris case it should also call __virRaiseError (that print to stderr could be lost), but perhaps it's better to #error out?
I made it use __virRaiseError everywhere. #error is unneccessarily harsh - all our APIs return -1 & raise an error if they're not implemented by a particular driver. Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|