mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
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>
This commit is contained in:
parent
ce702e93b0
commit
e31e3694af
2 changed files with 4 additions and 17 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue