From e31e3694afef58ba191cbcc6875ec243e5971268 Mon Sep 17 00:00:00 2001 From: Corentin Chary Date: Fri, 4 Feb 2011 09:05:58 +0100 Subject: vnc: palette: use a pool to reduce memory allocations We now that the palette will never have more than 256 elements. Let's use a pool to reduce malloc calls. Signed-off-by: Corentin Chary Signed-off-by: Anthony Liguori --- ui/vnc-palette.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ui/vnc-palette.h') diff --git a/ui/vnc-palette.h b/ui/vnc-palette.h index d0645ebde8..f57d0e7405 100644 --- a/ui/vnc-palette.h +++ b/ui/vnc-palette.h @@ -34,6 +34,7 @@ #include #define VNC_PALETTE_HASH_SIZE 256 +#define VNC_PALETTE_MAX_SIZE 256 typedef struct VncPaletteEntry { int idx; @@ -42,7 +43,7 @@ typedef struct VncPaletteEntry { } VncPaletteEntry; typedef struct VncPalette { - QObject_HEAD; + VncPaletteEntry pool[VNC_PALETTE_MAX_SIZE]; size_t size; size_t max; int bpp; -- cgit v1.2.3