aboutsummaryrefslogtreecommitdiff
path: root/ui/vnc-palette.c
diff options
context:
space:
mode:
authorCorentin Chary <corentincj@iksaif.net>2011-02-04 09:05:59 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2011-02-23 16:28:28 -0600
commit72aefb76f9268bec6eeb60530fd523b60effe610 (patch)
tree42996fc500d667e81f674e095126664d980c70c6 /ui/vnc-palette.c
parente31e3694afef58ba191cbcc6875ec243e5971268 (diff)
downloadqemu-72aefb76f9268bec6eeb60530fd523b60effe610.zip
qemu-72aefb76f9268bec6eeb60530fd523b60effe610.tar.gz
qemu-72aefb76f9268bec6eeb60530fd523b60effe610.tar.bz2
vnc: palette: add palette_init calls
This allow to use palette on the stack instead of always allocating them. Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'ui/vnc-palette.c')
-rw-r--r--ui/vnc-palette.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ui/vnc-palette.c b/ui/vnc-palette.c
index c47420b..f93250b 100644
--- a/ui/vnc-palette.c
+++ b/ui/vnc-palette.c
@@ -56,9 +56,15 @@ VncPalette *palette_new(size_t max, int bpp)
VncPalette *palette;
palette = qemu_mallocz(sizeof(*palette));
+ palette_init(palette, max, bpp);
+ return palette;
+}
+
+void palette_init(VncPalette *palette, size_t max, int bpp)
+{
+ memset(palette, 0, sizeof (*palette));
palette->max = max;
palette->bpp = bpp;
- return palette;
}
void palette_destroy(VncPalette *palette)