On 12/13/2010 02:06 AM, Jiri Denemark wrote:
So far, CPUID data were stored in two different data structures.
First
of them was a structure allowing direct access for CPUID data according
to function number and the second was a plain array of struct
cpuX86cpuid. This was a silly design which resulted in converting data
from one type to the other and back again or implementing similar
functionality for both data structures.
The patch leaves only the direct access structure. This makes the code
both smaller and more maintainable since operations on different objects
can use common low-level operations.
All 57 tests for cpu subsystem still pass after this rewrite.
---
src/cpu/cpu_x86.c | 576 +++++++++++++++++++++--------------------------
src/cpu/cpu_x86_data.h | 4 +-
2 files changed, 259 insertions(+), 321 deletions(-)
Nice cleanup.
ACK.
+
+static void
+x86DataIteratorInit(struct data_iterator *iter,
+ union cpuData *data)
+{
+ struct data_iterator init = DATA_ITERATOR_INIT(data);
+
+ *iter = init;
Is this any more efficient if init is marked static? Or can we even
bypass the init variable and just do *iter = DATA_ITERATOR_INIT(data)?
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org