On Tue, Oct 15, 2013 at 02:30:48PM +0200, Peter Krempa wrote:
Until now the map was loaded from the XML definition file every time
a
operation on the flags was requested. With the introduciton of one shot
initializers we can store the definition forever (as it will never
change) instead of parsing it over and over again.
---
src/cpu/cpu_x86.c | 67 ++++++++++++++++++++++++++++++-------------------------
1 file changed, 36 insertions(+), 31 deletions(-)
@@ -1064,22 +1068,34 @@ x86MapLoadCallback(enum cpuMapElement
element,
}
-static struct x86_map *
-x86LoadMap(void)
+int
+virCPUx86MapOnceInit(void)
{
struct x86_map *map;
if (VIR_ALLOC(map) < 0)
- return NULL;
+ return -1;
if (cpuMapLoad("x86", x86MapLoadCallback, map) < 0)
goto error;
- return map;
+ virCPUx86Map = map;
+
+ return 0;
error:
x86MapFree(map);
- return NULL;
+ return -1;
+}
I think I would have preferred to keep the x86LoadMap method and
just have the global initializer invoke that. That would let the
test suite load multiple different maps if it so needed in the
future.
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|