aboutsummaryrefslogtreecommitdiff
path: root/ui/vnc-palette.h
diff options
context:
space:
mode:
authorCorentin Chary <corentincj@iksaif.net>2011-02-04 09:05:58 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2011-02-23 16:28:28 -0600
commite31e3694afef58ba191cbcc6875ec243e5971268 (patch)
treeb5a18832ceb272a347843d9ed7b7798dd67b0079 /ui/vnc-palette.h
parentce702e93b0b99562ed42ba5c078914f2209b9a6a (diff)
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 <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'ui/vnc-palette.h')
-rw-r--r--ui/vnc-palette.h3
1 files changed, 2 insertions, 1 deletions
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 <stdint.h>
#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;